From: Ken'ichi Ohmichi Date: Thu, 10 Feb 2011 04:41:58 +0000 (+0900) Subject: Make --sticky option effective when setuid(2) and setgid(2) X-Git-Tag: v0.37.1~14 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e7c0c0888c3ba4698ccf5c7ebfd073af5749583d;p=thirdparty%2Flibcgroup.git Make --sticky option effective when setuid(2) and setgid(2) A cgrulesengd daemon did not check whether a stickied process or when setuid(2)/setgid(2) happens, and the daemon moved the process based on /etc/cgrules.conf. So --sticky option was not effective when setuid(2)/setgid(2). This patch makes --sticky effective when setuid(2) and setgid(2) also. Signed-off-by: Ken'ichi Ohmichi Signed-off-by: Dhaval Giani --- diff --git a/src/daemon/cgrulesengd.c b/src/daemon/cgrulesengd.c index 69165bfe..a2f9549e 100644 --- a/src/daemon/cgrulesengd.c +++ b/src/daemon/cgrulesengd.c @@ -339,6 +339,12 @@ int cgre_process_event(const struct proc_event *ev, const int type) switch (type) { case PROC_EVENT_UID: case PROC_EVENT_GID: + /* + * If the unchanged process, the daemon should not change the + * cgroup of the process. + */ + if (cgre_is_unchanged_process(ev->event_data.id.process_pid)) + return 0; pid = ev->event_data.id.process_pid; break; case PROC_EVENT_FORK: