2
0
Fork 0
mirror of https://github.com/fish-shell/fish-shell synced 2025-02-15 05:28:41 +00:00

Avoid hard compilation errors on platforms w/out O_ASYNC

Those platforms should not be using the sigio notifier in the first
place, this just stops them from failing to be able to compile fish
altogether.

See 
This commit is contained in:
Mahmoud Al-Qudsi 2021-02-21 22:39:32 -06:00
parent 9e1cd95eb1
commit 2cf5fd3d5d

View file

@ -1374,9 +1374,13 @@ class universal_notifier_sigio_t final : public universal_notifier_t {
}
// Note that O_ASYNC cannot be passed to open() (see Linux kernel bug #5993).
// We have to set it afterwards like so.
// Also Linux got support for O_ASYNC on fifos in 2.6 (released 2003).
// Do not be noisy if this fails.
if (fcntl(pipe.fd(), F_SETFL, O_NONBLOCK | O_ASYNC) == -1) {
// Linux got support for O_ASYNC on fifos in 2.6 (released 2003). Treat its absence as a
// failure, but don't be noisy if this fails. Non-Linux platforms without O_ASYNC should use
// a different notifier strategy to avoid running into this.
#ifdef O_ASYNC
if (fcntl(pipe.fd(), F_SETFL, O_NONBLOCK | O_ASYNC) == -1)
#endif
{
FLOGF(uvar_file,
_(L"fcntl(F_SETFL) failed, universal variable notifications disabled"));
return autoclose_fd_t{};