diff options
author | Philip Guenther <guenther@cvs.openbsd.org> | 2014-05-21 04:17:57 +0000 |
---|---|---|
committer | Philip Guenther <guenther@cvs.openbsd.org> | 2014-05-21 04:17:57 +0000 |
commit | 21d826b0a12dbb5ccafc0af5c5e61f39fa4dc3a2 (patch) | |
tree | aa2afdd8430fc9b0f57f53e23e6ae566d5a61ec8 /bin | |
parent | 244a762bfd54fec1f55a3e72fc03fd66e4472f5d (diff) |
Exit with non-zero status if a read is truncated, or if a compression
program was used but it didn't exit successfully.
Original diff by mpf@
Diffstat (limited to 'bin')
-rw-r--r-- | bin/pax/ar_io.c | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/bin/pax/ar_io.c b/bin/pax/ar_io.c index 2b237eb1470..ead73525720 100644 --- a/bin/pax/ar_io.c +++ b/bin/pax/ar_io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar_io.c,v 1.44 2014/01/11 05:36:26 deraadt Exp $ */ +/* $OpenBSD: ar_io.c,v 1.45 2014/05/21 04:17:56 guenther Exp $ */ /* $NetBSD: ar_io.c,v 1.5 1996/03/26 23:54:13 mrg Exp $ */ /*- @@ -331,14 +331,20 @@ ar_close(void) * for a quick extract/list, pax frequently exits before the child * process is done */ - if ((act == LIST || act == EXTRACT) && nflag && zpid > 0) + if ((act == LIST || act == EXTRACT) && nflag && zpid > 0) { kill(zpid, SIGINT); + zpid = -1; + } (void)close(arfd); /* Do not exit before child to ensure data integrity */ - if (zpid > 0) + if (zpid > 0) { waitpid(zpid, &status, 0); + if (!WIFEXITED(status) || WEXITSTATUS(status)) + exit_val = 1; + } + if (vflag && (artyp == ISTAPE)) { (void)fputs("done.\n", listf); @@ -567,7 +573,7 @@ ar_read(char *buf, int cnt) if (res < 0) syswarn(1, errno, "Failed read on archive volume %d", arvol); else - paxwarn(0, "End of archive volume %d reached", arvol); + paxwarn(1, "End of archive volume %d reached", arvol); return(res); } |