From 66dd83027da58f24cb9fb8cff960f17db7882245 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Fri, 8 Jun 2018 08:15:12 +0530 Subject: [PATCH] Use pipe2() on non-Apple platforms --- kitty/child-monitor.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/kitty/child-monitor.c b/kitty/child-monitor.c index c2aa04e89..65c6d19ce 100644 --- a/kitty/child-monitor.c +++ b/kitty/child-monitor.c @@ -111,6 +111,7 @@ handle_signal(int sig_num) { static inline bool self_pipe(int fds[2]) { +#ifdef __APPLE__ int flags; flags = pipe(fds); if (flags != 0) return false; @@ -123,6 +124,9 @@ self_pipe(int fds[2]) { if (fcntl(fds[i], F_SETFL, flags | O_NONBLOCK) == -1) { return false; } } return true; +#else + return pipe2(fds, O_CLOEXEC | O_NONBLOCK) == 0; +#endif }