fcntl doesn't take O_CLOEXEC, it takes FD_CLOEXEC

As reported on Android 14, which recently added a fortify check for fcntl
F_SETFD to make sure only FD_CLOEXEC is ever passed:
dfe67d266c

We can't pass anything else to it.  Even though on glibc, O_CLOEXEC
and FD_CLOEXEC are the same value, this isn't defined to be
portable in any way.

Fixes #900
Reported-By: Yuki San (@RealYukiSan)
Authored-By: Brad House (@bradh352)
v1.33
Brad House 2 months ago
parent 66d82612c2
commit 5f7816cb70
  1. 6
      src/lib/event/ares_event_wake_pipe.c

@ -92,9 +92,9 @@ static ares_pipeevent_t *ares_pipeevent_init(void)
} }
# endif # endif
# ifdef O_CLOEXEC # ifdef FD_CLOEXEC
fcntl(p->filedes[0], F_SETFD, O_CLOEXEC); fcntl(p->filedes[0], F_SETFD, FD_CLOEXEC);
fcntl(p->filedes[1], F_SETFD, O_CLOEXEC); fcntl(p->filedes[1], F_SETFD, FD_CLOEXEC);
# endif # endif
# endif # endif

Loading…
Cancel
Save