mirror of
https://github.com/fish-shell/fish-shell
synced 2024-12-27 21:33:09 +00:00
Handle ESRCH from setpgid(2) on FreeBSD
This commit is contained in:
parent
76faee71a5
commit
e4c052330f
1 changed files with 14 additions and 0 deletions
|
@ -94,6 +94,20 @@ int execute_setpgid(pid_t pid, pid_t pgroup, bool is_parent) {
|
|||
debug_safe(2, "setpgid(2) returned EPERM. Retrying");
|
||||
continue;
|
||||
}
|
||||
#ifdef __BSD__
|
||||
// POSIX.1 doesn't specify that zombie processes are required to be considered extant and/or
|
||||
// children of the parent for purposes of setpgid(2). In particular, FreeBSD (at least up to
|
||||
// 12.2) does not consider a child that has already forked, exec'd, and exited to "exist"
|
||||
// and returns ESRCH (process not found) instead of EACCES (child has called exec).
|
||||
// See https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=251227
|
||||
else if (err == ESRCH && is_parent) {
|
||||
// Handle this just like we would EACCES above, as we're virtually certain that
|
||||
// setpgid(2) was called against a process that was at least at one point in time a
|
||||
// valid child.
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
return err;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue