summaryrefslogtreecommitdiff
path: root/archivers/pax/files/ar_io.c
diff options
context:
space:
mode:
Diffstat (limited to 'archivers/pax/files/ar_io.c')
-rw-r--r--archivers/pax/files/ar_io.c15
1 files changed, 9 insertions, 6 deletions
diff --git a/archivers/pax/files/ar_io.c b/archivers/pax/files/ar_io.c
index 6fd13e9c2c8..5ae73c6128d 100644
--- a/archivers/pax/files/ar_io.c
+++ b/archivers/pax/files/ar_io.c
@@ -1,4 +1,4 @@
-/* $NetBSD: ar_io.c,v 1.2 2003/09/05 18:40:49 jlam Exp $ */
+/* $NetBSD: ar_io.c,v 1.3 2003/09/23 14:37:42 grant Exp $ */
/*-
* Copyright (c) 1992, 1993
@@ -78,7 +78,7 @@
#if 0
static char sccsid[] = "@(#)ar_io.c 8.2 (Berkeley) 4/18/94";
#else
-__RCSID("$NetBSD: ar_io.c,v 1.2 2003/09/05 18:40:49 jlam Exp $");
+__RCSID("$NetBSD: ar_io.c,v 1.3 2003/09/23 14:37:42 grant Exp $");
#endif
#endif /* not lint */
@@ -421,6 +421,8 @@ ar_open(const char *name)
void
ar_close(void)
{
+ int status;
+
if (arfd < 0) {
did_io = io_ok = flcnt = 0;
return;
@@ -456,11 +458,8 @@ 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);
- }
#ifdef SUPPORT_RMT
if (artyp == ISRMT)
@@ -469,6 +468,10 @@ ar_close(void)
#endif /* SUPPORT_RMT */
(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;