+static void wait_for_grandchild (pid_t pid) __attribute__ ((__noreturn__));
+
+/* Propagate any failure of the grandchild back to the parent. */
+static void
+wait_for_grandchild (pid_t pid)
+{
+ int wait_status;
+ int exit_code = 0;
+
+ while (waitpid (pid, &wait_status, 0) == -1)
+ if (errno != EINTR)
+ {
+ waitpid_error (use_compress_program_option);
+ break;
+ }
+
+ if (WIFSIGNALED (wait_status))
+ raise (WTERMSIG (wait_status));
+ else if (WEXITSTATUS (wait_status) != 0)
+ exit_code = WEXITSTATUS (wait_status);
+
+ exit (exit_code);
+}
+