]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
shutdown: make logging more useful if NULL swap/mount table files are specified
authorLennart Poettering <lennart@poettering.net>
Fri, 15 Nov 2019 13:56:35 +0000 (14:56 +0100)
committerLennart Poettering <lennart@poettering.net>
Fri, 15 Nov 2019 13:56:35 +0000 (14:56 +0100)
Makes the error output seen in #13993 more readable.

src/shutdown/umount.c

index 4563a9d720453c32987bd34edea60b18a5cecec1..4a96e1b79432abdcc618b92f7ae84364f7e09b6c 100644 (file)
@@ -62,7 +62,7 @@ int mount_points_list_get(const char *mountinfo, MountPoint **head) {
 
         r = libmount_parse(mountinfo, NULL, &table, &iter);
         if (r < 0)
-                return log_error_errno(r, "Failed to parse %s: %m", mountinfo);
+                return log_error_errno(r, "Failed to parse %s: %m", mountinfo ?: "/proc/self/mountinfo");
 
         for (;;) {
                 struct libmnt_fs *fs;
@@ -77,7 +77,7 @@ int mount_points_list_get(const char *mountinfo, MountPoint **head) {
                 if (r == 1)
                         break;
                 if (r < 0)
-                        return log_error_errno(r, "Failed to get next entry from %s: %m", mountinfo);
+                        return log_error_errno(r, "Failed to get next entry from %s: %m", mountinfo ?: "/proc/self/mountinfo");
 
                 path = mnt_fs_get_target(fs);
                 if (!path)
@@ -185,7 +185,7 @@ int swap_list_get(const char *swaps, MountPoint **head) {
 
         r = mnt_table_parse_swaps(t, swaps);
         if (r < 0)
-                return log_error_errno(r, "Failed to parse %s: %m", swaps);
+                return log_error_errno(r, "Failed to parse %s: %m", swaps ?: "/proc/swaps");
 
         for (;;) {
                 struct libmnt_fs *fs;
@@ -196,7 +196,7 @@ int swap_list_get(const char *swaps, MountPoint **head) {
                 if (r == 1)
                         break;
                 if (r < 0)
-                        return log_error_errno(r, "Failed to get next entry from %s: %m", swaps);
+                        return log_error_errno(r, "Failed to get next entry from %s: %m", swaps ?: "/proc/swaps");
 
                 source = mnt_fs_get_source(fs);
                 if (!source)