mirror of
https://git.savannah.gnu.org/git/tar.git
synced 2026-09-05 15:56:55 +00:00
Catch compressor execution errors.
* src/misc.c (write_fatal_details): Move to buffer.c * src/buffer.c (write_fatal_details): Close the archive and wait for the compressor program to terminate in order to catch eventual execution errors. * src/system.c (sys_child_open_for_compress): Ignore SIGPIPE so tar will not silently terminate when unable to write to the compressor. * tests/comperr.at: New file. * tests/Makefile.am: Add comperr.at * tests/testsuite.at: Include comperr.at
This commit is contained in:
@@ -1115,6 +1115,16 @@ close_archive (void)
|
||||
bufmap_free (NULL);
|
||||
}
|
||||
|
||||
void
|
||||
write_fatal_details (char const *name, ssize_t status, size_t size)
|
||||
{
|
||||
write_error_details (name, status, size);
|
||||
if (rmtclose (archive) != 0)
|
||||
close_error (*archive_name_cursor);
|
||||
sys_wait_for_child (child_pid, false);
|
||||
fatal_exit ();
|
||||
}
|
||||
|
||||
/* Called to initialize the global volume number. */
|
||||
void
|
||||
init_volume_number (void)
|
||||
|
||||
@@ -1113,13 +1113,6 @@ file_removed_diag (const char *name, bool top_level,
|
||||
diagfn (name);
|
||||
}
|
||||
|
||||
void
|
||||
write_fatal_details (char const *name, ssize_t status, size_t size)
|
||||
{
|
||||
write_error_details (name, status, size);
|
||||
fatal_exit ();
|
||||
}
|
||||
|
||||
/* Fork, aborting if unsuccessful. */
|
||||
pid_t
|
||||
xfork (void)
|
||||
|
||||
@@ -330,6 +330,7 @@ sys_child_open_for_compress (void)
|
||||
pid_t grandchild_pid;
|
||||
pid_t child_pid;
|
||||
|
||||
signal (SIGPIPE, SIG_IGN);
|
||||
xpipe (parent_pipe);
|
||||
child_pid = xfork ();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user