1
1

Close the pmix server sockets on exec

Этот коммит содержится в:
Ralph Castain 2014-12-13 20:30:21 -08:00
родитель f4ff791335
Коммит a22cc45769

Просмотреть файл

@ -54,6 +54,7 @@
#include "opal/util/opal_environ.h"
#include "opal/util/show_help.h"
#include "opal/util/error.h"
#include "opal/util/fd.h"
#include "opal/util/output.h"
#include "opal/opal_socket_errno.h"
#include "opal/util/if.h"
@ -412,6 +413,16 @@ static int pmix_server_start_listening(struct sockaddr_un *address)
}
return ORTE_ERR_IN_ERRNO;
}
/* Set the socket to close-on-exec so that no children inherit
this FD */
if (opal_fd_set_cloexec(sd) != OPAL_SUCCESS) {
opal_output(0, "pmix_server: unable to set the "
"listening socket to CLOEXEC (%s:%d)\n",
strerror(opal_socket_errno), opal_socket_errno);
CLOSE_THE_SOCKET(sd);
return ORTE_ERROR;
}
addrlen = sizeof(struct sockaddr_un);
if (bind(sd, (struct sockaddr*)address, addrlen) < 0) {
@ -501,6 +512,15 @@ static void connection_handler(int incoming_sd, short flags, void* cbdata)
}
return;
}
/* Set the socket to close-on-exec so that no subsequent children inherit
this FD */
if (opal_fd_set_cloexec(sd) != OPAL_SUCCESS) {
opal_output(0, "pmix_server_listen: unable to set the "
"listening socket to CLOEXEC (%s:%d)\n",
strerror(opal_socket_errno), opal_socket_errno);
CLOSE_THE_SOCKET(sd);
return;
}
/* get the handshake */
if (ORTE_SUCCESS != (rc = pmix_server_recv_connect_ack(NULL, sd, &hdr))) {