From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-710008-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	by finch.gentoo.org (Postfix) with ESMTP id D1E7513877A
	for <garchives@archives.gentoo.org>; Thu, 10 Jul 2014 17:08:32 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id 61CFFE09DE;
	Thu, 10 Jul 2014 17:08:30 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id DE107E09DE
	for <gentoo-commits@lists.gentoo.org>; Thu, 10 Jul 2014 17:08:29 +0000 (UTC)
Received: from spoonbill.gentoo.org (spoonbill.gentoo.org [81.93.255.5])
	(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 11B8833FD9B
	for <gentoo-commits@lists.gentoo.org>; Thu, 10 Jul 2014 17:08:29 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by spoonbill.gentoo.org (Postfix) with ESMTP id 0F9BB18011
	for <gentoo-commits@lists.gentoo.org>; Thu, 10 Jul 2014 17:08:27 +0000 (UTC)
From: "William Hubbs" <williamh@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Content-Transfer-Encoding: 8bit
Content-type: text/plain; charset=UTF-8
Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" <williamh@gentoo.org>
Message-ID: <1405007797.1a44be0f16a7a1de8a176e7c656f8513494e0e64.williamh@OpenRC>
Subject: [gentoo-commits] proj/openrc:master commit in: sh/
X-VCS-Repository: proj/openrc
X-VCS-Files: sh/runscript.sh.in
X-VCS-Directories: sh/
X-VCS-Committer: williamh
X-VCS-Committer-Name: William Hubbs
X-VCS-Revision: 1a44be0f16a7a1de8a176e7c656f8513494e0e64
X-VCS-Branch: master
Date: Thu, 10 Jul 2014 17:08:27 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: fb54b3cc-cb57-4de1-ad53-6899ed3d010d
X-Archives-Hash: 803512b6741666b28d63e31f2f74b771

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"