public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-commits] proj/openrc:0.35.x commit in: sh/
@ 2018-03-12  4:54 William Hubbs
  0 siblings, 0 replies; only message in thread
From: William Hubbs @ 2018-03-12  4:54 UTC (permalink / raw
  To: gentoo-commits

commit:     b731c02a389303dfba30a4b6c44efd0c2540bf66
Author:     William Hubbs <w.d.hubbs <AT> gmail <DOT> com>
AuthorDate: Mon Mar 12 02:40:57 2018 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Mar 12 04:16:51 2018 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=b731c02a

Clean up cgroups v2 code

Remove the IFS manipulation and simplify the loop that processes the
settings.

 sh/rc-cgroup.sh.in | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/sh/rc-cgroup.sh.in b/sh/rc-cgroup.sh.in
index 5bc7db54..d4b68ada 100644
--- a/sh/rc-cgroup.sh.in
+++ b/sh/rc-cgroup.sh.in
@@ -184,18 +184,17 @@ cgroup2_set_limits()
 	cgroup_path="$(cgroup2_find_path)"
 	[ -d "${cgroup_path}" ] || return 0
 	rc_cgroup_path="${cgroup_path}/${RC_SVCNAME}"
-	local OIFS="$IFS"
-	IFS="
-"
 	[ ! -d "${rc_cgroup_path}" ] && mkdir "${rc_cgroup_path}"
-	printf "%d" 0 > "${rc_cgroup_path}/cgroup.procs"
-	echo "${rc_cgroup_settings}" | while IFS="$OIFS" read -r key value; do
-		[ -z "${key}" ] || [ -z "${value}" ] && continue
-		[ ! -e "${rc_cgroup_path}/${key}" ] && continue
-		veinfo "${RC_SVCNAME}: cgroups: ${key} ${value}"
-		printf "%s" "${value}" > "${rc_cgroup_path}/${key}"
+	[ -f "${rc_cgroup_path}"/cgroup.procs ] &&
+		printf 0 > "${rc_cgroup_path}"/cgroup.procs
+	[ -z "${rc_cgroup_settings}" ] && return 0
+	echo "${rc_cgroup_settings}" | while read -r key value; do
+		[ -z "${key}" ] && continue
+		[ -z "${value}" ] && continue
+		[ ! -f "${rc_cgroup_path}/${key}" ] && continue
+		veinfo "${RC_SVCNAME}: cgroups: setting ${key} to ${value}"
+		printf "%s\n" "${value}" > "${rc_cgroup_path}/${key}"
 	done
-	IFS="$OIFS"
 	return 0
 }
 


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2018-03-12  4:54 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-03-12  4:54 [gentoo-commits] proj/openrc:0.35.x commit in: sh/ William Hubbs

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox