diff options
author | Ted Unangst <tedu@cvs.openbsd.org> | 2003-09-08 20:19:52 +0000 |
---|---|---|
committer | Ted Unangst <tedu@cvs.openbsd.org> | 2003-09-08 20:19:52 +0000 |
commit | b6e06c1b25d6ce68e48259d298e61dd0a0200c35 (patch) | |
tree | fb301352fda6d77c791335d14602e240e9dade83 /bin/pax/ar_io.c | |
parent | a37b9d2d5b4104256179927a79ac8d4b27e29f15 (diff) |
fix pr3455 from Joerg.Sonnenberger. slightly improved fix suggested by
millert@. ok beck@ deraadt@ millert@
Diffstat (limited to 'bin/pax/ar_io.c')
-rw-r--r-- | bin/pax/ar_io.c | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/bin/pax/ar_io.c b/bin/pax/ar_io.c index 6a84dbbca20..13cac1bbac6 100644 --- a/bin/pax/ar_io.c +++ b/bin/pax/ar_io.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ar_io.c,v 1.33 2003/06/02 23:32:08 millert Exp $ */ +/* $OpenBSD: ar_io.c,v 1.34 2003/09/08 20:19:51 tedu Exp $ */ /* $NetBSD: ar_io.c,v 1.5 1996/03/26 23:54:13 mrg Exp $ */ /*- @@ -38,7 +38,7 @@ #if 0 static const char sccsid[] = "@(#)ar_io.c 8.2 (Berkeley) 4/18/94"; #else -static const char rcsid[] = "$OpenBSD: ar_io.c,v 1.33 2003/06/02 23:32:08 millert Exp $"; +static const char rcsid[] = "$OpenBSD: ar_io.c,v 1.34 2003/09/08 20:19:51 tedu Exp $"; #endif #endif /* not lint */ @@ -302,6 +302,7 @@ ar_open(const char *name) void ar_close(void) { + int status; if (arfd < 0) { did_io = io_ok = flcnt = 0; @@ -337,14 +338,15 @@ 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) { - int status; + if ((act == LIST || act == EXTRACT) && nflag && zpid > 0) kill(zpid, SIGINT); - waitpid(zpid, &status, 0); - } (void)close(arfd); + /* Do not exit before child to ensure data integrity */ + if (zpid > 0) + waitpid(zpid, &status, 0); + if (vflag && (artyp == ISTAPE)) { (void)fputs("done.\n", listf); vfpart = 0; |