From 75b7852c92f4dcc43e5263999e16f76d6ac763db Mon Sep 17 00:00:00 2001 From: Robert Garrett Date: Wed, 10 Sep 2003 22:43:54 +0000 Subject: [PATCH] The first a bug in pax and should be commited to FBSD, too. Further info in OpenBSD's system/3455. From: Joerg Sonnenberg --- bin/pax/ar_io.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/bin/pax/ar_io.c b/bin/pax/ar_io.c index eafa8cd73f..452d19dd22 100644 --- a/bin/pax/ar_io.c +++ b/bin/pax/ar_io.c @@ -36,7 +36,7 @@ * * @(#)ar_io.c 8.2 (Berkeley) 4/18/94 * $FreeBSD: src/bin/pax/ar_io.c,v 1.12.2.1 2001/08/01 05:03:11 obrien Exp $ - * $DragonFly: src/bin/pax/ar_io.c,v 1.2 2003/06/17 04:22:50 dillon Exp $ + * $DragonFly: src/bin/pax/ar_io.c,v 1.3 2003/09/10 22:43:54 rob Exp $ */ #include @@ -307,6 +307,7 @@ void ar_close() #endif { + int status; if (arfd < 0) { did_io = io_ok = flcnt = 0; @@ -342,14 +343,15 @@ ar_close() * 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; -- 2.41.0