From dfd9effc8de62e99778ee0ea44f5877ed2dedcb9 Mon Sep 17 00:00:00 2001 From: Jan Safranek Date: Wed, 30 Nov 2011 15:42:08 +0100 Subject: [PATCH] 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 --- src/api.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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)) -- 2.47.2