summaryrefslogtreecommitdiff
path: root/source3
diff options
context:
space:
mode:
authorAndreas Schneider <asn@samba.org>2012-12-13 17:29:39 +0100
committerGünther Deschner <gd@samba.org>2012-12-21 13:55:59 +0100
commita3bbf1bf3460034028516c1c0fced01db0cecd0c (patch)
treef141e2f4c5f2cbbc744cefd353f3ab24c44a508f /source3
parente136b95af82e200dfc28dd3e48e05c210862f906 (diff)
downloadsamba-a3bbf1bf3460034028516c1c0fced01db0cecd0c.tar.gz
samba-a3bbf1bf3460034028516c1c0fced01db0cecd0c.tar.bz2
samba-a3bbf1bf3460034028516c1c0fced01db0cecd0c.zip
s3-winbind: 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/winbindd/winbindd.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/source3/winbindd/winbindd.c b/source3/winbindd/winbindd.c
index 7e8a1b58e8..698c96cd53 100644
--- a/source3/winbindd/winbindd.c
+++ b/source3/winbindd/winbindd.c
@@ -1285,6 +1285,7 @@ int main(int argc, char **argv, char **envp)
int opt;
TALLOC_CTX *frame;
NTSTATUS status;
+ bool ok;
/*
* Do this before any other talloc operation
@@ -1424,12 +1425,18 @@ int main(int argc, char **argv, char **envp)
exit(1);
}
- 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);
}
/* Setup names. */