mirror of
https://github.com/troglobit/finit.git
synced 2026-10-27 12:20:54 +00:00
tmpfiles: set mode and owner of d/D directories through an fd
makedir() swallows EEXIST, so the chmod branch for directories that already existed never ran, while chown() ran every time. On finix /var/empty is immutable, which gave a warning on every boot even though the owner was already correct. mksubsys() is the original of this code and has the same shape, the dbus plugin uses it for /tmp/dbus. Both now go through dirperm(), which opens the directory and uses fstat/fchmod/fchown on the fd, changing only what differs. A failed chown in mksubsys() is a warning now rather than err(1), PID 1 should not exit over a directory it cannot adjust. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
1 parent
7e2b154f9b
commit
3a72d1263c
3 files changed
+34
-9
No files matched your search
@@ -68,6 +68,7 @@ int getgroup (const char *group);
|
||||
int getcuser (char *buf, size_t len);
|
||||
int getcgroup (char *buf, size_t len);
|
||||
|
||||
int dirperm (const char *path, mode_t mode, uid_t uid, gid_t gid);
|
||||
int mksubsys (const char *dir, mode_t mode, char *user, char *group);
|
||||
|
||||
int fnread (char *buf, size_t len, char *fmt, ...) __attribute__ ((format (printf, 3, 4)));
|
||||
|
||||
Reference in new issue
Block a user