diff options
author | Lennart Poettering <lennart@poettering.net> | 2014-06-10 23:42:16 +0200 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2014-06-10 23:42:16 +0200 |
commit | e73a03e059830a3df8fac811f923704311e93731 (patch) | |
tree | 43e68b863f40aac29f942695c1544a112204eece /src/shared | |
parent | 849958d1ba3533c953fad46d4d41c0ec6e48316d (diff) |
tmpfiles: get rid of "m" lines, make them redundant by "z"
"m" so far has been a non-globbing version of "z". Since this makes it
quite redundant, let's get rid of it. Remove "m" from the man pages,
beef up "z" docs instead, and make "m" nothing more than a compatibility
alias for "z".
Diffstat (limited to 'src/shared')
-rw-r--r-- | src/shared/mkdir.c | 15 | ||||
-rw-r--r-- | src/shared/mkdir.h | 2 |
2 files changed, 11 insertions, 6 deletions
diff --git a/src/shared/mkdir.c b/src/shared/mkdir.c index ba083d6d67..f941efb401 100644 --- a/src/shared/mkdir.c +++ b/src/shared/mkdir.c @@ -58,11 +58,16 @@ int mkdir_safe(const char *path, mode_t mode, uid_t uid, gid_t gid) { return mkdir_safe_internal(path, mode, uid, gid, mkdir); } -int is_dir(const char* path) { +int is_dir(const char* path, bool follow) { struct stat st; - if (stat(path, &st) < 0) - return -errno; + if (follow) { + if (stat(path, &st) < 0) + return -errno; + } else { + if (lstat(path, &st) < 0) + return -errno; + } return S_ISDIR(st.st_mode); } @@ -85,7 +90,7 @@ int mkdir_parents_internal(const char *prefix, const char *path, mode_t mode, mk return 0; p = strndupa(path, e - path); - r = is_dir(p); + r = is_dir(p, true); if (r > 0) return 0; if (r == 0) @@ -130,7 +135,7 @@ int mkdir_p_internal(const char *prefix, const char *path, mode_t mode, mkdir_fu return r; r = _mkdir(path, mode); - if (r < 0 && (errno != EEXIST || is_dir(path) <= 0)) + if (r < 0 && (errno != EEXIST || is_dir(path, true) <= 0)) return -errno; return 0; diff --git a/src/shared/mkdir.h b/src/shared/mkdir.h index f1bf4c0a68..d15ede6064 100644 --- a/src/shared/mkdir.h +++ b/src/shared/mkdir.h @@ -41,4 +41,4 @@ typedef int (*mkdir_func_t)(const char *pathname, mode_t mode); int mkdir_safe_internal(const char *path, mode_t mode, uid_t uid, gid_t gid, mkdir_func_t _mkdir); int mkdir_parents_internal(const char *prefix, const char *path, mode_t mode, mkdir_func_t _mkdir); int mkdir_p_internal(const char *prefix, const char *path, mode_t mode, mkdir_func_t _mkdir); -int is_dir(const char *path); +int is_dir(const char *path, bool is_dir); |