lib/util: add useful debug messages to directory_create_or_exist()
authorStefan Metzmacher <metze@samba.org>
Wed, 23 Oct 2019 13:28:22 +0000 (15:28 +0200)
committerStefan Metzmacher <metze@samba.org>
Tue, 29 Oct 2019 13:33:03 +0000 (14:33 +0100)
We have similar messages in directory_create_or_exist_strict() already.

This doesn't solve https://bugzilla.samba.org/show_bug.cgi?id=14166,
but it displays errors which allows admins to find the problem.

Signed-off-by: Stefan Metzmacher <metze@samba.org>
lib/util/util.c

index 3bdeded5c1b6e29095f04ddfacea27235ac4fae8..b00fed9db304fdae647cc1fb131cc92b5d9b6efc 100644 (file)
@@ -366,10 +366,14 @@ _PUBLIC_ bool directory_create_or_exist(const char *dname,
 
                ret = lstat(dname, &sbuf);
                if (ret != 0) {
+                       DBG_ERR("lstat failed on created directory %s: %s\n",
+                               dname, strerror(errno));
                        return false;
                }
 
                if (!S_ISDIR(sbuf.st_mode)) {
+                       DBG_ERR("directory %s isn't a directory\n",
+                               dname);
                        return false;
                }
        }