summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-03-14 10:41:47 +0100
committerStefan Metzmacher <metze@samba.org>2012-03-14 12:00:46 +0100
commitbd492befc0cbaa3d1ba3438a62d6e4832b98ee54 (patch)
treee4e3734d8e23d94454dc95e18876c1bdaf2b46e2
parent687606b452ce6f9ebd853f4ffb569e513e38685c (diff)
downloadsamba-bd492befc0cbaa3d1ba3438a62d6e4832b98ee54.tar.gz
samba-bd492befc0cbaa3d1ba3438a62d6e4832b98ee54.tar.bz2
samba-bd492befc0cbaa3d1ba3438a62d6e4832b98ee54.zip
lib/util: remove unneeded else branch in directory_create_or_exist()
metze
-rw-r--r--lib/util/util.c45
1 files changed, 24 insertions, 21 deletions
diff --git a/lib/util/util.c b/lib/util/util.c
index 9f4fed07d6..1a5c9a196b 100644
--- a/lib/util/util.c
+++ b/lib/util/util.c
@@ -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;
}