pid_t child;
#endif
int exit_status;
- int waitpid_return;
+ pid_t waitpid_return;
int child_stdin, child_stdout;
char *out_buf;
if (state->waitpid_return < 0) {
/* waitpid() failed? This is ugly. */
archive_set_error(&self->archive->archive, ARCHIVE_ERRNO_MISC,
- "Child process exited badly");
+ "Error closing child process");
return (ARCHIVE_WARN);
}
struct archive_write_program_data *data)
{
int ret, status;
+ pid_t pid;
ssize_t bytes_read;
if (data->child == 0)
close(data->child_stdin);
if (data->child_stdout != -1)
close(data->child_stdout);
- while (waitpid(data->child, &status, 0) == -1 && errno == EINTR)
- continue;
+ do {
+ pid = waitpid(data->child, &status, 0);
+ } while (pid == -1 && errno == EINTR);
data->child = 0;
- if (status != 0) {
+ if (pid < 0 || status != 0) {
archive_set_error(f->archive, EIO,
"Error closing program: %s", data->program_name);
ret = ARCHIVE_FATAL;