From a3bbf1bf3460034028516c1c0fced01db0cecd0c Mon Sep 17 00:00:00 2001 From: Andreas Schneider Date: Thu, 13 Dec 2012 17:29:39 +0100 Subject: s3-winbind: Check if we created the directories correctly. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Found by Coverity. Signed-off-by: Andreas Schneider Reviewed-by: Günther Deschner --- source3/winbindd/winbindd.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) (limited to 'source3/winbindd') 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. */ -- cgit