mirror of
https://github.com/troglobit/finit.git
synced 2026-11-23 20:11:44 +00:00
util: remove mksubsys(), it has no callers
Services get their directories from mksubsysd(), which takes the ids already resolved. Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
3 files changed
+2
-20
No files matched your search
@@ -34,4 +34,3 @@ Missing options: `--root`, `--replace`, and `--purge`.
|
|||||||
ones
|
ones
|
||||||
* `a` and `A` handle an ACL of at most 32 entries, a path with more is
|
* `a` and `A` handle an ACL of at most 32 entries, a path with more is
|
||||||
left as it is, with a warning
|
left as it is, with a warning
|
||||||
* `mksubsys()` in `src/util.c` is unused
|
|
||||||
+2
-18
@@ -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
|
* Create @dir with @mode and owner, -1 keeps the id the directory has.
|
||||||
* the directory has. Parents are created 0755, only the leaf gets @mode.
|
* Parents are created 0755, only the leaf gets @mode.
|
||||||
*/
|
*/
|
||||||
int mksubsysd(const char *dir, mode_t mode, uid_t uid, gid_t gid)
|
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;
|
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.
|
* Read an open stream to EOF into a malloc()'ed, NUL terminated buffer.
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -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 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 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 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 chownr (const char *path, uid_t uid, gid_t gid);
|
||||||
int rmcontents (const char *path);
|
int rmcontents (const char *path);
|
||||||
|
|||||||
Reference in new issue
Block a user