aboutsummaryrefslogtreecommitdiff
path: root/bin/pax
diff options
context:
space:
mode:
authorDavid E. O'Brien <obrien@FreeBSD.org>2005-03-12 06:38:01 +0000
committerDavid E. O'Brien <obrien@FreeBSD.org>2005-03-12 06:38:01 +0000
commit5f44e053cc2f9c4775b8d004dbd49be03f292107 (patch)
tree34d9aaf3fa211e1f387e35d8f7e48bae1d54ac4c /bin/pax
parentbdc172ab8faac407bdd8a5a506ed036e2a6b050a (diff)
downloadsrc-5f44e053cc2f9c4775b8d004dbd49be03f292107.tar.gz
src-5f44e053cc2f9c4775b8d004dbd49be03f292107.zip
Fix bin/pax doesn't wait for compress/gzip before exiting.
Submitted by: Joerg Sonnenberger <joerg@britannica.bec.de> Obtained from: OpenBSD (commited fix to PR 3455)
Notes
Notes: svn path=/head/; revision=143447
Diffstat (limited to 'bin/pax')
-rw-r--r--bin/pax/ar_io.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/bin/pax/ar_io.c b/bin/pax/ar_io.c
index 0ae50421ed08..3588374257b5 100644
--- a/bin/pax/ar_io.c
+++ b/bin/pax/ar_io.c
@@ -301,6 +301,7 @@ ar_open(const char *name)
void
ar_close(void)
{
+ int status;
if (arfd < 0) {
did_io = io_ok = flcnt = 0;
@@ -336,14 +337,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;