util: promote rmrf() from tmpfiles.c, fix silent mksubsys() skip

rmrf() is needed outside tmpfiles.c.  The move also deduplicates the
nftw callback: the contents-only removal used by tmpfiles 'D' entries
is now rmcontents(), sharing the callback with rmrf().

mksubsys() did nothing at all when the user could not be resolved, no
directory and no message, and callers had no way to tell.  Now the
directory is always created, ownership is best effort, and an unknown
user is warned about.

Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
Joachim Wiberg committed 2026-07-30 15:23:37 +02:00
1 parent 6615a248ee
commit 7f8a64dd39
3 files changed
+46 -34

No files matched your search

+2
View File
@@ -72,6 +72,8 @@ int getcuser (char *buf, size_t len);
int getcgroup (char *buf, size_t len);
int mksubsys (const char *dir, mode_t mode, char *user, char *group);
int rmcontents (const char *path);
int rmrf (const char *path);
char *fslurp (size_t *lenp, const char *fmt, ...) __attribute__ ((format (printf, 2, 3)));
char *vfslurp (size_t *lenp, const char *fmt, va_list ap);