mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-10 21:23:58 +01:00
Fix another case of bug 8206; patch from flupzor
This commit is contained in:
parent
eff1cfaaf7
commit
0b827cbcb1
@ -1172,10 +1172,22 @@ tor_socketpair(int family, int type, int protocol, tor_socket_t fd[2])
|
|||||||
return -errno;
|
return -errno;
|
||||||
|
|
||||||
#if defined(FD_CLOEXEC)
|
#if defined(FD_CLOEXEC)
|
||||||
if (SOCKET_OK(fd[0]))
|
if (SOCKET_OK(fd[0])) {
|
||||||
fcntl(fd[0], F_SETFD, FD_CLOEXEC);
|
r = fcntl(fd[0], F_SETFD, FD_CLOEXEC);
|
||||||
if (SOCKET_OK(fd[1]))
|
if (r == -1) {
|
||||||
fcntl(fd[1], F_SETFD, FD_CLOEXEC);
|
close(fd[0]);
|
||||||
|
close(fd[1]);
|
||||||
|
return -errno;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (SOCKET_OK(fd[1])) {
|
||||||
|
r = fcntl(fd[1], F_SETFD, FD_CLOEXEC);
|
||||||
|
if (r == -1) {
|
||||||
|
close(fd[0]);
|
||||||
|
close(fd[1]);
|
||||||
|
return -errno;
|
||||||
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
goto sockets_ok; /* So that sockets_ok will not be unused. */
|
goto sockets_ok; /* So that sockets_ok will not be unused. */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user