When unpacking compressed archive check exit status of the child (gzip or bzip)
and exit with error code if that status != 0. PR: 30876 Submitted by: Simon Gerraty <sig@juniper.net>
This commit is contained in:
parent
e0ee6f5629
commit
12397b2bad
@ -1256,6 +1256,21 @@ close_archive ()
|
||||
if (f_verify)
|
||||
verify_volume ();
|
||||
|
||||
#ifndef __MSDOS__
|
||||
/*
|
||||
* Closing the child's pipe before reading EOF guarantees that it
|
||||
* will be unhappy - SIGPIPE, or exit 1.
|
||||
* Either way it can screw us, so play nice.
|
||||
*/
|
||||
if (childpid && ar_reading)
|
||||
{
|
||||
char buf[BUFSIZ];
|
||||
|
||||
while ((c = read(archive, buf, sizeof(buf))) > 0)
|
||||
;
|
||||
}
|
||||
#endif
|
||||
|
||||
if ((c = rmtclose (archive)) < 0)
|
||||
msg_perror ("Warning: can't close %s(%d,%d)", ar_files[cur_ar_file], archive, c);
|
||||
|
||||
@ -1294,8 +1309,11 @@ close_archive ()
|
||||
/* Do nothing. */
|
||||
}
|
||||
else if (WEXITSTATUS (status))
|
||||
msg ("child returned status %d",
|
||||
WEXITSTATUS (status));
|
||||
{
|
||||
msg ("child returned status %d",
|
||||
WEXITSTATUS (status));
|
||||
exit (EX_BADARCH);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user