mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-28 14:23:30 +01:00
Check that FD_CLOEXEC is set before using it
I don't know if any platforms we care about don't have FD_CLOEXEC, but this is what we do elsewhere
This commit is contained in:
parent
367794ce02
commit
a961521a86
@ -1026,7 +1026,7 @@ tor_socketpair(int family, int type, int protocol, int fd[2])
|
|||||||
#endif
|
#endif
|
||||||
r = socketpair(family, type, protocol, fd);
|
r = socketpair(family, type, protocol, fd);
|
||||||
if (r == 0) {
|
if (r == 0) {
|
||||||
#ifndef SOCK_CLOEXEC
|
#if !defined(SOCK_CLOEXEC) && defined(FD_CLOEXEC)
|
||||||
if (fd[0] >= 0)
|
if (fd[0] >= 0)
|
||||||
fcntl(fd[0], F_SETFD, FD_CLOEXEC);
|
fcntl(fd[0], F_SETFD, FD_CLOEXEC);
|
||||||
if (fd[1] >= 0)
|
if (fd[1] >= 0)
|
||||||
|
Loading…
Reference in New Issue
Block a user