chiark
/
gitweb
/
~ianmdlvl
/
elogind.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
nspawn: when resoliving UIDs/GIDs for "-u", do so in forked off /usr/bin/getent inste...
[elogind.git]
/
src
/
shared
/
mkdir.c
diff --git
a/src/shared/mkdir.c
b/src/shared/mkdir.c
index 4a2cd5e662b499398d964a90ba7773f2e17ca73e..b35551eb0212a0e601dd181055f033dc9cc0fa1a 100644
(file)
--- a/
src/shared/mkdir.c
+++ b/
src/shared/mkdir.c
@@
-41,7
+41,9
@@
int mkdir_safe_internal(const char *path, mode_t mode, uid_t uid, gid_t gid, mkd
if (lstat(path, &st) < 0)
return -errno;
if (lstat(path, &st) < 0)
return -errno;
- if ((st.st_mode & 0777) != mode ||
+ if ((st.st_mode & 0007) > (mode & 0007) ||
+ (st.st_mode & 0070) > (mode & 0070) ||
+ (st.st_mode & 0700) > (mode & 0700) ||
(uid != (uid_t) -1 && st.st_uid != uid) ||
(gid != (gid_t) -1 && st.st_gid != gid) ||
!S_ISDIR(st.st_mode)) {
(uid != (uid_t) -1 && st.st_uid != uid) ||
(gid != (gid_t) -1 && st.st_gid != gid) ||
!S_ISDIR(st.st_mode)) {