[PATCH] partx: exit with error code when partition read failed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxx>
Reported-by: Juan Céspedes <cespedes@xxxxxxxxxx>
Addresses: https://bugs.debian.org/898426
---
 disk-utils/partx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/disk-utils/partx.c b/disk-utils/partx.c
index 3ccd1afad..f895b9be3 100644
--- a/disk-utils/partx.c
+++ b/disk-utils/partx.c
@@ -1054,7 +1054,9 @@ int main(int argc, char **argv)
 			default:
 				abort();
 			}
-		}
+		} else
+			rc = 1;
+
 		blkid_free_probe(pr);
 	}
 
-- 
2.17.1

--
To unsubscribe from this list: send the line "unsubscribe util-linux" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux