Removing #ifdefs around fcntl(FD_CLOSEXEC)

This commit is contained in:
manojampalam 2016-03-19 13:25:43 -07:00
parent 8601d0ccd6
commit bf74d01af3
5 changed files with 0 additions and 20 deletions

View File

@ -105,7 +105,6 @@ ssh_get_authentication_socket(int *fdp)
if ((sock = socket(AF_UNIX, SOCK_STREAM, 0)) < 0)
return SSH_ERR_SYSTEM_ERROR;
#ifndef WIN32_FIXME
/* close on exec */
if (fcntl(sock, F_SETFD, FD_CLOEXEC) == -1 ||
connect(sock, (struct sockaddr *)&sunaddr, sizeof(sunaddr)) < 0) {
@ -114,15 +113,6 @@ ssh_get_authentication_socket(int *fdp)
errno = oerrno;
return SSH_ERR_SYSTEM_ERROR;
}
#else
if (
connect(sock, (struct sockaddr *)&sunaddr, sizeof(sunaddr)) < 0) {
oerrno = errno;
close(sock);
errno = oerrno;
return SSH_ERR_SYSTEM_ERROR;
}
#endif /* #ifndef WIN32_FIXME */
if (fdp != NULL)
*fdp = sock;

View File

@ -253,14 +253,12 @@ channel_register_fds(Channel *c, int rfd, int wfd, int efd,
channel_max_fd = MAX(channel_max_fd, wfd);
channel_max_fd = MAX(channel_max_fd, efd);
#ifndef WIN32_FIXME
if (rfd != -1)
fcntl(rfd, F_SETFD, FD_CLOEXEC);
if (wfd != -1 && wfd != rfd)
fcntl(wfd, F_SETFD, FD_CLOEXEC);
if (efd != -1 && efd != rfd && efd != wfd)
fcntl(efd, F_SETFD, FD_CLOEXEC);
#endif
c->rfd = rfd;
c->wfd = wfd;

View File

@ -142,7 +142,6 @@ static int notify_pipe[2];
static void
notify_setup(void)
{
#ifndef WIN32_FIXME /* This was causing heap corruption */
if (pipe(notify_pipe) < 0) {
error("pipe(notify_pipe) failed %s", strerror(errno));
} else if ((fcntl(notify_pipe[0], F_SETFD, FD_CLOEXEC) == -1) ||
@ -155,9 +154,6 @@ notify_setup(void)
set_nonblock(notify_pipe[1]);
return;
}
#endif
notify_pipe[0] = -1; /* read end */
notify_pipe[1] = -1; /* write end */
}
static void
notify_parent(void)

View File

@ -414,9 +414,7 @@ ssh_create_socket(int privileged, struct addrinfo *ai)
error("socket: %s", strerror(errno));
return -1;
}
#ifndef WIN32_FIXME
fcntl(sock, F_SETFD, FD_CLOEXEC);
#endif
/* Bind the socket to an alternative local IP address */
if (options.bind_address == NULL && !privileged)

2
sshd.c
View File

@ -2900,11 +2900,9 @@ main(int ac, char **av)
#endif /* !WIN32_FIXME */
}
#ifndef WIN32_FIXME
/* Executed child processes don't need these. */
fcntl(sock_out, F_SETFD, FD_CLOEXEC);
fcntl(sock_in, F_SETFD, FD_CLOEXEC);
#endif
/*
* Disable the key regeneration alarm. We will not regenerate the