From: Jan Safranek Date: Wed, 30 Nov 2011 14:42:08 +0000 (+0100) Subject: cgconfigparser: Allow SUID and SGID permissions in 'fperm' and 'dperm' options. X-Git-Tag: v0.38~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=dfd9effc8de62e99778ee0ea44f5877ed2dedcb9;p=thirdparty%2Flibcgroup.git cgconfigparser: Allow SUID and SGID permissions in 'fperm' and 'dperm' options. libcgroup should allow SUID, SGID or sticky bit to be set either in cgconfig.conf file or in API calls. Especially the sticky bit can be useful for cooperation with systemd. Signed-off-by: Jan Safranek --- diff --git a/src/api.c b/src/api.c index 0c55f1ab..e2d56ef3 100644 --- a/src/api.c +++ b/src/api.c @@ -197,6 +197,7 @@ int cg_chmod_path(const char *path, mode_t mode, int owner_is_umask) * Use owner permissions as an umask for group and others * permissions because we trust kernel to initialize owner * permissions to something useful. + * Keep SUID and SGID bits. */ if (stat(path, &buf) == -1) goto fail; @@ -204,7 +205,7 @@ int cg_chmod_path(const char *path, mode_t mode, int owner_is_umask) gmask = umask >> 3; omask = gmask >> 3; - mask = umask|gmask|omask; + mask = umask|gmask|omask|S_ISUID|S_ISGID|S_ISVTX; } if (chmod(path, mode & mask))