s3-winbind: Check if we created the directories correctly.
[kai/samba.git] / source3 / winbindd / winbindd.c
index 7e8a1b58e8cd39ccdfa9100d776ebac7d0c7bb38..698c96cd539c57d7d248d0eadde3ea7929bb5eb8 100644 (file)
@@ -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. */