From: Karel Zak Date: Tue, 13 Dec 2016 11:11:18 +0000 (+0100) Subject: fdisk: don't be silent when list non-existing device X-Git-Tag: v2.30-rc1~348 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=8fdd483c5331671b3ab31a1a240aeb1e2c2840c6;p=thirdparty%2Futil-linux.git fdisk: don't be silent when list non-existing device Addresses: https://github.com/karelzak/util-linux/issues/376 Signed-off-by: Karel Zak --- diff --git a/disk-utils/fdisk.c b/disk-utils/fdisk.c index 1bf5b82901..df7f0ceb34 100644 --- a/disk-utils/fdisk.c +++ b/disk-utils/fdisk.c @@ -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;