]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
namespace: improve logging when creating mount source nodes
authorLennart Poettering <lennart@poettering.net>
Wed, 4 Apr 2018 09:12:49 +0000 (11:12 +0200)
committerLennart Poettering <lennart@poettering.net>
Wed, 18 Apr 2018 12:15:48 +0000 (14:15 +0200)
src/core/namespace.c

index ec6b0a5ae7435d6628494191c7ade5143895da3f..32d8ca63efbd029c017b9a8351d9a7267ba8441a 100644 (file)
@@ -948,14 +948,22 @@ static int apply_mount(
 
                         /* Hmm, either the source or the destination are missing. Let's see if we can create the destination, then try again */
 
-                        if (stat(what, &st) >= 0) {
+                        if (stat(what, &st) < 0)
+                                log_debug_errno(errno, "Mount point source '%s' is not accessible: %m", what);
+                        else {
+                                int q;
 
                                 (void) mkdir_parents(mount_entry_path(m), 0755);
 
                                 if (S_ISDIR(st.st_mode))
-                                        try_again = mkdir(mount_entry_path(m), 0755) >= 0;
+                                        q = mkdir(mount_entry_path(m), 0755) < 0 ? -errno : 0;
                                 else
-                                        try_again = touch(mount_entry_path(m)) >= 0;
+                                        q = touch(mount_entry_path(m));
+
+                                if (q < 0)
+                                        log_debug_errno(q, "Failed to create destination mount point node '%s': %m", mount_entry_path(m));
+                                else
+                                        try_again = true;
                         }
                 }