mirror of
https://github.com/systemd/systemd-stable.git
synced 2025-01-03 01:17:45 +03:00
mkdir: chase_symlinks_and_stat() does not return 0
This reverts commitse22916e61d
and1e146d7382
.
This commit is contained in:
parent
4b544b5ffd
commit
f1d93b84bc
@ -19,7 +19,8 @@
|
||||
int mkdir_safe_internal(
|
||||
const char *path,
|
||||
mode_t mode,
|
||||
uid_t uid, gid_t gid,
|
||||
uid_t uid,
|
||||
gid_t gid,
|
||||
MkdirFlags flags,
|
||||
mkdirat_func_t _mkdirat) {
|
||||
|
||||
@ -42,13 +43,16 @@ int mkdir_safe_internal(
|
||||
if ((flags & MKDIR_FOLLOW_SYMLINK) && S_ISLNK(st.st_mode)) {
|
||||
_cleanup_free_ char *p = NULL;
|
||||
|
||||
r = chase_symlinks_and_stat(path, NULL, 0, &p, &st, NULL);
|
||||
r = chase_symlinks(path, NULL, CHASE_NONEXISTENT, &p, NULL);
|
||||
if (r < 0)
|
||||
return r;
|
||||
if (r == 0)
|
||||
return mkdir_safe_internal(p, mode, uid, gid,
|
||||
flags & ~MKDIR_FOLLOW_SYMLINK,
|
||||
_mkdirat);
|
||||
|
||||
if (lstat(p, &st) < 0)
|
||||
return -errno;
|
||||
}
|
||||
|
||||
if (flags & MKDIR_IGNORE_EXISTING)
|
||||
|
Loading…
Reference in New Issue
Block a user