commit:     1a44be0f16a7a1de8a176e7c656f8513494e0e64
Author:     Alexander V Vershilov <qnikst <AT> gentoo <DOT> org>
AuthorDate: Sun Feb 16 00:27:52 2014 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Thu Jul 10 15:56:37 2014 +0000
URL:        
http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=1a44be0f

cgroups: only run cgroup setup when starting a service

Status call should not set limits as it requires root permissions,
also this is not safe, as current process may reach limitation.

Solution is to set limits and move process to service cgroup only
on start.

X-GENTOO-BUG: 500364
X-GENTOO-BUG-URL: https://bugs.gentoo.org/show_bug.cgi?id=500364

---
 sh/runscript.sh.in | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/sh/runscript.sh.in b/sh/runscript.sh.in
index ceb9ab4..c72a784 100644
--- a/sh/runscript.sh.in
+++ b/sh/runscript.sh.in
@@ -215,12 +215,14 @@ if yesno "${rc_verbose:-$RC_VERBOSE}"; then
 fi
 
 # Apply cgroups settings if defined
+if [ "$1" = "start" ] ; then
 if [ "$(command -v cgroup_add_service)" = "cgroup_add_service" ]; then
        cgroup_add_service /sys/fs/cgroup/openrc
        cgroup_add_service /sys/fs/cgroup/systemd/system
 fi
 [ "$(command -v cgroup_set_limits)" = "cgroup_set_limits" ] && \
        cgroup_set_limits
+fi
 
 # Load our script
 sourcex "$RC_SERVICE"

Reply via email to