summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2012-12-13 18:16:34 +0100
committerGünther Deschner <gd@samba.org>2012-12-21 13:56:00 +0100
commit3000fc29c373f7fcc59f4de443f209f377dbd4f6 (patch)
tree61eab0018b18000b30ec85e5547749e5742d407e /source3
parent6fd4724fb95cda3adfee37b6bde7e526e423083d (diff)
downloadsamba-3000fc29c373f7fcc59f4de443f209f377dbd4f6.tar.gz
samba-3000fc29c373f7fcc59f4de443f209f377dbd4f6.tar.bz2
samba-3000fc29c373f7fcc59f4de443f209f377dbd4f6.zip
s3-nmbd: Check if we created the directories correctly.
Found by Coverity. Signed-off-by: Andreas Schneider <asn@samba.org> Reviewed-by: Günther Deschner <gd@samba.org>
Diffstat (limited to 'source3')
-rw-r--r--source3/nmbd/nmbd.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c
index d4df2020d5..49f0cdf457 100644
--- a/source3/nmbd/nmbd.c
+++ b/source3/nmbd/nmbd.c
@@ -788,6 +788,7 @@ static bool open_sockets(bool isdaemon, int port)
};
TALLOC_CTX *frame;
NTSTATUS status;
+ bool ok;
/*
* Do this before any other talloc operation
@@ -945,12 +946,18 @@ static bool open_sockets(bool isdaemon, int port)
}
#endif
- if (!directory_exist(lp_lockdir())) {
- mkdir(lp_lockdir(), 0755);
+ ok = directory_create_or_exist(lp_lockdir(), geteuid(), 0755);
+ if (!ok) {
+ DEBUG(0, ("Failed to create directory %s for lock files - %s\n",
+ lp_lockdir(), strerror(errno)));
+ exit(1);
}
- if (!directory_exist(lp_piddir())) {
- mkdir(lp_piddir(), 0755);
+ ok = directory_create_or_exist(lp_piddir(), geteuid(), 0755);
+ if (!ok) {
+ DEBUG(0, ("Failed to create directory %s for pid files - %s\n",
+ lp_piddir(), strerror(errno)));
+ exit(1);
}
pidfile_create(lp_piddir(), "nmbd");