[BusyBox] gunzip -t always return zero on broken .gz
SHOJI Yasushi
yashi at atmark-techno.com
Fri Dec 20 01:55:03 UTC 2002
Hi all,
gunzip in busybox-stable doesn't return non zero even if the testing
archive is broken.
GNU gunzip and busybox unstable returns 1 at least on my box (debian
sid)
i'm attaching a patch anyway. it's against current busybox.stable cvs.
tia,
--
yashi
Index: gunzip.c
===================================================================
RCS file: /var/cvs/busybox.stable/gunzip.c,v
retrieving revision 1.62
diff -u -r1.62 gunzip.c
--- gunzip.c 20 Sep 2002 08:21:21 -0000 1.62
+++ gunzip.c 20 Dec 2002 08:33:35 -0000
@@ -77,6 +77,7 @@
struct stat stat_buf;
const char *delete_path = NULL;
char *out_path = NULL;
+ int status = -1;
if (path == NULL || strcmp (path, "-") == 0) {
in_file = stdin;
@@ -137,6 +138,7 @@
if (flags & gunzip_verbose) {
fprintf(stderr, "OK\n");
}
+ status = 0;
} else {
/* remove failed attempt */
delete_path = out_path;
@@ -153,7 +155,7 @@
free(out_path);
- return 0;
+ return status;
}
extern int gunzip_main(int argc, char **argv)
More information about the busybox
mailing list