partx: exit with error code when partition read failed

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
This commit is contained in:
Andreas Henriksson 2018-06-17 14:49:15 +02:00 committed by Karel Zak
parent e60b6df54e
commit aeda8dc3d0
1 changed files with 3 additions and 1 deletions

View File

@ -1054,7 +1054,9 @@ int main(int argc, char **argv)
default:
abort();
}
}
} else
rc = 1;
blkid_free_probe(pr);
}