Skip to content

Commit

Permalink
Correctly detect SOCK_CLOEXEC
Browse files Browse the repository at this point in the history
SOCK_CLOEXEC expands to an enum, so it cannot be used in preprocessor
conditionals.

(cherry picked from commit b7851c8)
  • Loading branch information
DemiMarie authored and marmarek committed May 12, 2023
1 parent 558ade2 commit 297e098
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions libqrexec/exec.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 297e098

Please sign in to comment.