mirror of
https://github.com/fish-shell/fish-shell.git
synced 2025-03-15 23:22:53 +08:00
Use anon semaphores only on Linux
On BSDs, anonymous semaphores are implemented using a file descriptor which is not marked CLOEXEC, so it gets leaked into child processes. Use ordinary pipes instead of semaphores everywhere except Linux. Fixes #7304
This commit is contained in:
parent
acb33682a9
commit
1cef87d790
@ -39,7 +39,9 @@ wcstring generation_list_t::describe() const {
|
||||
|
||||
binary_semaphore_t::binary_semaphore_t() : sem_ok_(false) {
|
||||
// sem_init always fails with ENOSYS on Mac and has an annoying deprecation warning.
|
||||
#ifndef __APPLE__
|
||||
// On BSD sem_init uses a file descriptor under the hood which doesn't get CLOEXEC (see #7304).
|
||||
// So use fast semaphores on Linux only.
|
||||
#ifdef __linux__
|
||||
sem_ok_ = (0 == sem_init(&sem_, 0, 0));
|
||||
#endif
|
||||
if (!sem_ok_) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user