mirror of
https://github.com/troglobit/finit.git
synced 2026-11-23 20:11:44 +00:00
tmpfiles: keep the mode of an existing directory when none is given
A d entry without a mode reset an existing directory to 0755. On
finix a bare "d /tmp" line took the sticky bit and the write
permission for others off the /tmp mount, so nobody but root could
create files there:
mkdir -p /tmp/t && chmod 1777 /tmp/t
echo 'd /tmp/t' > t.conf
tmpfiles --create t.conf
stat -c %a /tmp/t
This gave 755. Commit 9bfbdc6b made the chmod of an existing
directory work, and it used the 0755 default for a new directory as
the mode to set.
The default is now only for creating the directory. With no mode in
the entry, dirperm() leaves the mode alone.
Fixes #523
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
4 files changed
+45
-5
No files matched your search
+1
-3
@@ -558,9 +558,7 @@ static void tmpfiles(char *line)
|
||||
if (gid < 0)
|
||||
gid = 0;
|
||||
|
||||
if (!mode)
|
||||
mode = 0755;
|
||||
rc = makedir(path, mode);
|
||||
rc = makedir(path, mode ?: 0755);
|
||||
if (!rc && dirperm(path, mode, uid, gid))
|
||||
warn("Failed setting mode/owner on %s", path);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user