1 |
commit: 7f3b41311119e3a96a15b0fb473b44f422e903e9 |
2 |
Author: William Hubbs <w.d.hubbs <AT> gmail <DOT> com> |
3 |
AuthorDate: Fri Sep 29 17:50:05 2017 +0000 |
4 |
Commit: William Hubbs <williamh <AT> gentoo <DOT> org> |
5 |
CommitDate: Fri Sep 29 17:51:12 2017 +0000 |
6 |
URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=7f3b4131 |
7 |
|
8 |
use printf consistently in cgroups handling |
9 |
|
10 |
This makes the cgroups handling consistent between cgroups v1 and v2. |
11 |
Also, it fixes #167. |
12 |
|
13 |
sh/rc-cgroup.sh.in | 6 +++--- |
14 |
1 file changed, 3 insertions(+), 3 deletions(-) |
15 |
|
16 |
diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in |
17 |
index 9e93d841..d48957ac 100644 |
18 |
--- a/sh/rc-cgroup.sh.in |
19 |
+++ b/sh/rc-cgroup.sh.in |
20 |
@@ -165,7 +165,7 @@ cgroup2_remove() |
21 |
[ ! -e "${rc_cgroup_path}"/cgroup.events ] && |
22 |
return 0 |
23 |
grep -qx "$$" "${rc_cgroup_path}/cgroup.procs" && |
24 |
- echo 0 > "${cgroup_path}/cgroup.procs" |
25 |
+ printf "%d" 0 > "${cgroup_path}/cgroup.procs" |
26 |
local key populated vvalue |
27 |
while read -r key value; do |
28 |
case "${key}" in |
29 |
@@ -188,12 +188,12 @@ cgroup2_set_limits() |
30 |
IFS=" |
31 |
" |
32 |
[ ! -d "${rc_cgroup_path}" ] && mkdir "${rc_cgroup_path}" |
33 |
- echo 0 > "${rc_cgroup_path}/cgroup.procs" |
34 |
+ printf "%d" 0 > "${rc_cgroup_path}/cgroup.procs" |
35 |
echo "${rc_cgroup_settings}" | while IFS="$OIFS" read -r key value; do |
36 |
[ -z "${key}" ] || [ -z "${value}" ] && continue |
37 |
[ ! -e "${rc_cgroup_path}/${key}" ] && continue |
38 |
veinfo "${RC_SVCNAME}: cgroups: ${key} ${value}" |
39 |
- echo "${value}" > "${rc_cgroup_path}/${key}" |
40 |
+ printf "%s" "${value}" > "${rc_cgroup_path}/${key}" |
41 |
done |
42 |
IFS="$OIFS" |
43 |
return 0 |