1
0
mirror of https://github.com/samba-team/samba.git synced 2024-12-23 17:34:34 +03:00

lib/util: remove unneeded else branch in directory_create_or_exist()

metze
This commit is contained in:
Stefan Metzmacher 2012-03-14 10:41:47 +01:00
parent 687606b452
commit bd492befc0

View File

@ -165,28 +165,31 @@ _PUBLIC_ bool directory_create_or_exist(const char *dname, uid_t uid,
umask(old_umask);
return false;
}
} else {
/* Check ownership and permission on existing directory */
if (!S_ISDIR(st.st_mode)) {
DEBUG(0, ("directory %s isn't a directory\n",
dname));
umask(old_umask);
return false;
}
if (st.st_uid != uid && !uwrap_enabled()) {
DEBUG(0, ("invalid ownership on directory "
"%s\n", dname));
umask(old_umask);
return false;
}
if ((st.st_mode & 0777) != dir_perms) {
DEBUG(0, ("invalid permissions on directory "
"'%s': has 0%o should be 0%o\n", dname,
(st.st_mode & 0777), dir_perms));
umask(old_umask);
return false;
}
return true;
}
/* Check ownership and permission on existing directory */
if (!S_ISDIR(st.st_mode)) {
DEBUG(0, ("directory %s isn't a directory\n",
dname));
umask(old_umask);
return false;
}
if (st.st_uid != uid && !uwrap_enabled()) {
DEBUG(0, ("invalid ownership on directory "
"%s\n", dname));
umask(old_umask);
return false;
}
if ((st.st_mode & 0777) != dir_perms) {
DEBUG(0, ("invalid permissions on directory "
"'%s': has 0%o should be 0%o\n", dname,
(st.st_mode & 0777), dir_perms));
umask(old_umask);
return false;
}
return true;
}