]> git.ipfire.org Git - thirdparty/util-linux.git/commitdiff
partx: exit with error code when partition read failed
authorAndreas Henriksson <andreas@fatal.se>
Sun, 17 Jun 2018 12:49:15 +0000 (14:49 +0200)
committerKarel Zak <kzak@redhat.com>
Wed, 11 Jul 2018 14:11:25 +0000 (16:11 +0200)
Make sure partx exits with a non-0 return code when
it runs into either code-path where getting the partition
table failed (or wasn't even attempted because of previous
error condition).

Change was tested using:
touch /tmp/foobar
partx -s - /tmp/foobar

Previously that was only printing an error/warning message
and then exiting with 0, but after this change it exits
with 1.

Signed-off-by: Andreas Henriksson <andreas@fatal.se>
Reported-by: Juan Céspedes <cespedes@debian.org>
Addresses: https://bugs.debian.org/898426

disk-utils/partx.c

index 43a6448dbb4b81216e66f0eb463918868662c6a5..e3443ea804ca3efe2f15f34b5ee74f7cc15a1133 100644 (file)
@@ -1047,7 +1047,9 @@ int main(int argc, char **argv)
                        default:
                                abort();
                        }
-               }
+               } else
+                       rc = 1;
+
                blkid_free_probe(pr);
        }