From 297e098ee7f0a9edc0793f25e4ab800a76bdf8db Mon Sep 17 00:00:00 2001 From: Demi Marie Obenour Date: Fri, 31 Mar 2023 21:35:17 -0400 Subject: [PATCH] Correctly detect SOCK_CLOEXEC SOCK_CLOEXEC expands to an enum, so it cannot be used in preprocessor conditionals. (cherry picked from commit b7851c857fd002eb5dd11871c904626dbd406f01) --- libqrexec/exec.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/libqrexec/exec.c b/libqrexec/exec.c index 800816ed..41444c2f 100644 --- a/libqrexec/exec.c +++ b/libqrexec/exec.c @@ -127,10 +127,10 @@ static int do_fork_exec(const char *user, fix_fds(inpipe[0], outpipe[1], 2); close(statuspipe[0]); -#if !SOCK_CLOEXEC - status = fcntl(statuspipe[1], F_GETFD); - fcntl(statuspipe[1], F_SETFD, status | FD_CLOEXEC); -#endif + if (SOCK_CLOEXEC == (0)) { + status = fcntl(statuspipe[1], F_GETFD); + fcntl(statuspipe[1], F_SETFD, status | FD_CLOEXEC); + } if (exec_func != NULL) exec_func(cmdline, user); else