Fixed no-op loop hang

This commit is contained in:
Mahmoud Al-Qudsi 2017-07-28 18:08:46 -05:00 committed by Kurtis Rader
parent d6c4e66484
commit 8537cc982e

View File

@ -82,8 +82,9 @@ bool child_set_group(job_t *j, process_t *p) {
//because we are SIGSTOPing the previous job in the chain. Sometimes we have to try a few
//times to get the kernel to see the new group. (Linux 4.4.0)
int failure = setpgid(p->pid, j->pgid);
while (failure == -1 && errno == EPERM) {
while (failure == -1 && (errno == EPERM || errno == EINTR)) {
debug_safe(2, "Retrying setpgid in child process");
failure = setpgid(p->pid, j->pgid);
}
// TODO: Figure out why we're testing whether the pgid is correct after attempting to
// set it failed. This was added in commit 4e912ef8 from 2012-02-27.