]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
nspawn: make the error message less confusing
authorFrantisek Sumsal <frantisek@sumsal.cz>
Thu, 18 May 2023 13:14:20 +0000 (15:14 +0200)
committerFrantisek Sumsal <frantisek@sumsal.cz>
Thu, 18 May 2023 14:50:24 +0000 (16:50 +0200)
by not printing (null) and dropping the extraneous slash, e.g.:

systemd-nspawn[2049]: Failed to resolve (null)//proc: Permission denied

src/nspawn/nspawn-mount.c

index ac9dc5116e8d72c3d4819e4f246b8d6b5f736307..fcf5c710f1d376eac45f525dd203743d120d5223 100644 (file)
@@ -638,7 +638,7 @@ int mount_all(const char *dest,
 
                 r = chase(mount_table[k].where, dest, CHASE_NONEXISTENT|CHASE_PREFIX_ROOT, &where, NULL);
                 if (r < 0)
-                        return log_error_errno(r, "Failed to resolve %s/%s: %m", dest, mount_table[k].where);
+                        return log_error_errno(r, "Failed to resolve %s%s: %m", strempty(dest), mount_table[k].where);
 
                 /* Skip this entry if it is not a remount. */
                 if (mount_table[k].what) {
@@ -697,7 +697,7 @@ int mount_all(const char *dest,
                          * for those. */
                         r = chase(mount_table[k].what, dest, CHASE_PREFIX_ROOT, &prefixed, NULL);
                         if (r < 0)
-                                return log_error_errno(r, "Failed to resolve %s/%s: %m", dest, mount_table[k].what);
+                                return log_error_errno(r, "Failed to resolve %s%s: %m", strempty(dest), mount_table[k].what);
                 }
 
                 r = mount_verbose_full(