Avoid race condition with accept4 where available
Linux provides accept4(2) which will return a socket with FD_CLOEXEC set when called with the SOCK_CLOEXEC flag. So call this when available and fall back to fcntl(..., FD_CLOEXEC) if not.
Showing
Please
register
or
sign in
to comment