]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
fdisk: don't be silent when list non-existing device
authorKarel Zak <kzak@redhat.com>
Tue, 13 Dec 2016 11:11:18 +0000 (12:11 +0100)
committerKarel Zak <kzak@redhat.com>
Tue, 13 Dec 2016 11:11:32 +0000 (12:11 +0100)
Addresses: https://github.com/karelzak/util-linux/issues/376
Signed-off-by: Karel Zak <kzak@redhat.com>
disk-utils/fdisk.c

index 1bf5b8290195ebcae33172a6f38ae44b2370faf4..df7f0ceb349e57c8b2fc082af381095bb544ab85 100644 (file)
@@ -944,12 +944,16 @@ int main(int argc, char **argv)
                if (argc > optind) {
                        int k;
                        int ct = 0;
-                       for (k = optind; k < argc; k++) {
+
+                       for (rc = 0, k = optind; k < argc; k++) {
                                if (ct)
                                    fputs("\n\n", stdout);
+
+                               rc += print_device_pt(cxt, argv[k], 1, 0);
                                ct++;
-                               print_device_pt(cxt, argv[k], 1, 0);
                        }
+                       if (rc)
+                               return EXIT_FAILURE;
                } else
                        print_all_devices_pt(cxt, 0);
                break;