bool __igt_fork_helper(struct igt_helper_process *proc)
{
pid_t pid;
+ sighandler_t oldsig;
int id;
assert(!proc->running);
igt_install_exit_handler(fork_helper_exit_handler);
+ /*
+ * XXX: There's a race between fork and the subsequent kill in
+ * igt_stop_signal_helper if we don't ovewrite the SIGQUIT handler. Note
+ * that inserting sufficient amounts of printf or other delays makes
+ * this unnecessary.
+ */
+ oldsig = signal(SIGQUIT, SIG_DFL);
switch (pid = fork()) {
case -1:
igt_assert(0);
return true;
default:
+ signal(SIGQUIT, oldsig);
+
proc->running = true;
proc->pid = pid;
proc->id = id;
assert(proc->running);
assert(kill(proc->pid, SIGQUIT) == 0);
- waitpid(proc->pid, &status, 0);
+ while (waitpid(proc->pid, &status, 0) == -1 &&
+ errno == -EINTR)
+ ;
proc->running = false;