From e8717862737bbf8f5388cdfe068265e0aec0fe68 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 4 Apr 2018 11:12:49 +0200 Subject: [PATCH] namespace: improve logging when creating mount source nodes --- src/core/namespace.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/core/namespace.c b/src/core/namespace.c index ec6b0a5ae7..32d8ca63ef 100644 --- a/src/core/namespace.c +++ b/src/core/namespace.c @@ -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; } }