diff options
-rw-r--r-- | src/shared/util.c | 26 | ||||
-rw-r--r-- | src/shared/util.h | 2 |
2 files changed, 13 insertions, 15 deletions
diff --git a/src/shared/util.c b/src/shared/util.c index ba86d20615..3eb8a0f442 100644 --- a/src/shared/util.c +++ b/src/shared/util.c @@ -2941,6 +2941,19 @@ int rm_rf_children(int fd, bool only_dirs, bool honour_sticky, struct stat *root return rm_rf_children_dangerous(fd, only_dirs, honour_sticky, root_dev); } +static int file_is_priv_sticky(const char *p) { + struct stat st; + + assert(p); + + if (lstat(p, &st) < 0) + return -errno; + + return + (st.st_uid == 0 || st.st_uid == getuid()) && + (st.st_mode & S_ISVTX); +} + static int rm_rf_internal(const char *path, bool only_dirs, bool delete_root, bool honour_sticky, bool dangerous) { int fd, r; struct statfs s; @@ -4829,19 +4842,6 @@ int block_get_whole_disk(dev_t d, dev_t *ret) { return -ENOENT; } -int file_is_priv_sticky(const char *p) { - struct stat st; - - assert(p); - - if (lstat(p, &st) < 0) - return -errno; - - return - (st.st_uid == 0 || st.st_uid == getuid()) && - (st.st_mode & S_ISVTX); -} - static const char *const ioprio_class_table[] = { [IOPRIO_CLASS_NONE] = "none", [IOPRIO_CLASS_RT] = "realtime", diff --git a/src/shared/util.h b/src/shared/util.h index 4997225d83..24480be682 100644 --- a/src/shared/util.h +++ b/src/shared/util.h @@ -582,8 +582,6 @@ static inline bool _pure_ in_charset(const char *s, const char* charset) { int block_get_whole_disk(dev_t d, dev_t *ret); -int file_is_priv_sticky(const char *p); - #define NULSTR_FOREACH(i, l) \ for ((i) = (l); (i) && *(i); (i) = strchr((i), 0)+1) |