diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-11-07 01:19:14 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-11-07 01:19:56 +0100 |
commit | b5e1fad5b1b9d29694e8c51245821a732fc22f93 (patch) | |
tree | ad63c217dbb883bf7463d26be2330fa08ac26a00 /src/shared | |
parent | 25e14499c4c5b02229d05a5bc26c3693ade5f987 (diff) |
util: file_is_priv_sticky() is used internally in util.c only nowadays, make it static
Diffstat (limited to 'src/shared')
-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) |