summaryrefslogtreecommitdiff
path: root/src/shared/mkdir.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/shared/mkdir.c')
-rw-r--r--src/shared/mkdir.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/shared/mkdir.c b/src/shared/mkdir.c
index 43c6ea6d4a..4a2cd5e662 100644
--- a/src/shared/mkdir.c
+++ b/src/shared/mkdir.c
@@ -42,8 +42,8 @@ int mkdir_safe_internal(const char *path, mode_t mode, uid_t uid, gid_t gid, mkd
return -errno;
if ((st.st_mode & 0777) != mode ||
- st.st_uid != uid ||
- st.st_gid != gid ||
+ (uid != (uid_t) -1 && st.st_uid != uid) ||
+ (gid != (gid_t) -1 && st.st_gid != gid) ||
!S_ISDIR(st.st_mode)) {
errno = EEXIST;
return -errno;