summaryrefslogtreecommitdiff
path: root/source3/lib
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2013-06-17 16:16:31 -0700
committerJeremy Allison <jra@samba.org>2013-06-18 02:41:10 +0200
commitfcc43cfbe34f3e8039c5e1364fc327f3d7b88b12 (patch)
tree5dc72b92f0a9f55d5b632b3c2f7d4d1ea3931bd5 /source3/lib
parentd924da9bc82bbb9f088eb15ac58377e2a1ae3a58 (diff)
downloadsamba-fcc43cfbe34f3e8039c5e1364fc327f3d7b88b12.tar.gz
samba-fcc43cfbe34f3e8039c5e1364fc327f3d7b88b12.tar.bz2
samba-fcc43cfbe34f3e8039c5e1364fc327f3d7b88b12.zip
Fix xx_path() - return check from mkdir() is incorrect.
This is very old code, but mkdir() fails with -1, not 0. Only print the error message is mkdir failed with anything other than EEXIST. Signed-off-by: Jeremy Allison <jra@samba.org> Reviewed-by: Ira Cooper <ira@samba.org>
Diffstat (limited to 'source3/lib')
-rw-r--r--source3/lib/util.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/source3/lib/util.c b/source3/lib/util.c
index d21c730f3b..93aab3c2ad 100644
--- a/source3/lib/util.c
+++ b/source3/lib/util.c
@@ -1517,9 +1517,14 @@ static char *xx_path(const char *name, const char *rootpath)
trim_string(fname,"","/");
if (!directory_exist(fname)) {
- if (!mkdir(fname,0755))
- DEBUG(1, ("Unable to create directory %s for file %s. "
- "Error was %s\n", fname, name, strerror(errno)));
+ if (mkdir(fname,0755) == -1) {
+ /* Did someone else win the race ? */
+ if (errno != EEXIST) {
+ DEBUG(1, ("Unable to create directory %s for file %s. "
+ "Error was %s\n", fname, name, strerror(errno)));
+ return NULL;
+ }
+ }
}
return talloc_asprintf_append(fname, "/%s", name);