summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2012-03-14 10:43:54 +0100
committerStefan Metzmacher <metze@samba.org>2012-03-14 12:00:46 +0100
commitf30626111994c0a5a4b886f52de1f62bfc52de3c (patch)
tree760c47897b6e6456df6b1a1225b1457011ed7103 /lib
parentbd492befc0cbaa3d1ba3438a62d6e4832b98ee54 (diff)
downloadsamba-f30626111994c0a5a4b886f52de1f62bfc52de3c.tar.gz
samba-f30626111994c0a5a4b886f52de1f62bfc52de3c.tar.bz2
samba-f30626111994c0a5a4b886f52de1f62bfc52de3c.zip
lib/util: do an early return on error directory_create_or_exist()
metze
Diffstat (limited to 'lib')
-rw-r--r--lib/util/util.c20
1 files changed, 10 insertions, 10 deletions
diff --git a/lib/util/util.c b/lib/util/util.c
index 1a5c9a196b..54237c57d8 100644
--- a/lib/util/util.c
+++ b/lib/util/util.c
@@ -150,22 +150,22 @@ _PUBLIC_ bool directory_create_or_exist(const char *dname, uid_t uid,
old_umask = umask(0);
if (lstat(dname, &st) == -1) {
- if (errno == ENOENT) {
- /* Create directory */
- if (mkdir(dname, dir_perms) == -1) {
- DEBUG(0, ("mkdir failed on directory "
- "%s: %s\n", dname,
- strerror(errno)));
- umask(old_umask);
- return false;
- }
- } else {
+ if (errno != ENOENT) {
DEBUG(0, ("lstat failed on directory %s: %s\n",
dname, strerror(errno)));
umask(old_umask);
return false;
}
+ /* Create directory */
+ if (mkdir(dname, dir_perms) == -1) {
+ DEBUG(0, ("mkdir failed on directory "
+ "%s: %s\n", dname,
+ strerror(errno)));
+ umask(old_umask);
+ return false;
+ }
+
return true;
}