summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortedu <tedu@openbsd.org>2003-09-08 20:19:51 +0000
committertedu <tedu@openbsd.org>2003-09-08 20:19:51 +0000
commit5e9612f3b8785f45b1f39308e487a667e58955aa (patch)
treea2c6b537c7ea5e29e78c3cb5d0c76938434c1d00
parentremove -compact to make page more readable, plus some typos; (diff)
downloadwireguard-openbsd-5e9612f3b8785f45b1f39308e487a667e58955aa.tar.xz
wireguard-openbsd-5e9612f3b8785f45b1f39308e487a667e58955aa.zip
fix pr3455 from Joerg.Sonnenberger. slightly improved fix suggested by
millert@. ok beck@ deraadt@ millert@
-rw-r--r--bin/pax/ar_io.c14
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;