diff --git a/doc/tmpfiles-todo.md b/doc/tmpfiles-todo.md index 7a0b31fc..f873ebcf 100644 --- a/doc/tmpfiles-todo.md +++ b/doc/tmpfiles-todo.md @@ -34,4 +34,3 @@ Missing options: `--root`, `--replace`, and `--purge`. ones * `a` and `A` handle an ACL of at most 32 entries, a path with more is left as it is, with a warning -* `mksubsys()` in `src/util.c` is unused diff --git a/src/util.c b/src/util.c index c1b4d89d..51b880a8 100644 --- a/src/util.c +++ b/src/util.c @@ -415,8 +415,8 @@ int dirperm(const char *path, mode_t mode, uid_t uid, gid_t gid) } /* - * Like mksubsys() but with the ids already resolved, -1 keeps the id - * the directory has. Parents are created 0755, only the leaf gets @mode. + * Create @dir with @mode and owner, -1 keeps the id the directory has. + * Parents are created 0755, only the leaf gets @mode. */ int mksubsysd(const char *dir, mode_t mode, uid_t uid, gid_t gid) { @@ -434,22 +434,6 @@ int mksubsysd(const char *dir, mode_t mode, uid_t uid, gid_t gid) return rc; } -int mksubsys(const char *dir, mode_t mode, char *user, char *group) -{ - int uid, gid; - - uid = getuser(user, NULL); - gid = getgroup(group); - if (uid < 0) { - warnx("Cannot find user %s, %s is owned by root", user, dir); - gid = -1; - } else if (gid < 0) { - gid = 0; - } - - return mksubsysd(dir, mode, (uid_t)uid, (gid_t)gid); -} - /* * Read an open stream to EOF into a malloc()'ed, NUL terminated buffer. * diff --git a/src/util.h b/src/util.h index be519de1..6589106d 100644 --- a/src/util.h +++ b/src/util.h @@ -73,7 +73,6 @@ int getcgroup (char *buf, size_t len); int fdperm (int fd, mode_t mode, uid_t uid, gid_t gid); 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 mksubsysd (const char *dir, mode_t mode, uid_t uid, gid_t gid); int chownr (const char *path, uid_t uid, gid_t gid); int rmcontents (const char *path);