Skip to contentSkip to conversation

partx: exit with error code when partition read failed

PATCH Applied Andreas Henriksson 2 participants 2 messages Jun 17, 2018 – Jun 18, 2018 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

Addresses: https://bugs.debian.org/898426

---
 disk-utils/partx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
disk-utils/partx.c +3 -1
index 3ccd1afad..f895b9be3 100644
@@ -1054,7 +1054,9 @@ int main(int argc, char **argv)
 			default:
 				abort();
 			}
-		}
+		} else
+			rc = 1;
+
 		blkid_free_probe(pr);
 	}
 
Signature · 1 line
2.17.1
maintainer Applied
#1 lore raw
Quoted 2 lines · Andreas Henriksson
 disk-utils/partx.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com