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:
Sergey Poznyakoff
2015-12-05 16:54:26 +02:00
parent 6ea9e62bb3
commit 589ba77faf
6 changed files with 52 additions and 7 deletions
+10
View File
@@ -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)
-7
View File
@@ -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)
+1
View File
@@ -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 ();