Close oob/usock connections upon exec
Этот коммит содержится в:
родитель
6c4d5a51c4
Коммит
f4ff791335
@ -58,6 +58,7 @@
|
||||
#include "opal/util/output.h"
|
||||
#include "opal/util/net.h"
|
||||
#include "opal/util/error.h"
|
||||
#include "opal/util/fd.h"
|
||||
#include "opal/class/opal_hash_table.h"
|
||||
#include "opal/mca/event/event.h"
|
||||
|
||||
@ -104,6 +105,14 @@ static int usock_peer_create_socket(mca_oob_usock_peer_t* peer)
|
||||
opal_socket_errno);
|
||||
return ORTE_ERR_UNREACH;
|
||||
}
|
||||
/* Set this fd to be close-on-exec so that subsequent children don't see it */
|
||||
if (opal_fd_set_cloexec(peer->sd) != OPAL_SUCCESS) {
|
||||
opal_output(0, "%s unable to set socket to CLOEXEC",
|
||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
|
||||
close(peer->sd);
|
||||
peer->sd = -1;
|
||||
return ORTE_ERROR;
|
||||
}
|
||||
|
||||
/* setup event callbacks */
|
||||
usock_peer_event_init(peer);
|
||||
|
@ -52,6 +52,7 @@
|
||||
#include "opal/util/error.h"
|
||||
#include "opal/util/output.h"
|
||||
#include "opal/opal_socket_errno.h"
|
||||
#include "opal/util/fd.h"
|
||||
#include "opal/util/if.h"
|
||||
#include "opal/util/net.h"
|
||||
#include "opal/util/argv.h"
|
||||
@ -96,6 +97,13 @@ int orte_oob_usock_start_listening(void)
|
||||
}
|
||||
return ORTE_ERR_IN_ERRNO;
|
||||
}
|
||||
/* Set this fd to be close-on-exec so that children don't see it */
|
||||
if (opal_fd_set_cloexec(sd) != OPAL_SUCCESS) {
|
||||
opal_output(0, "%s unable to set socket to CLOEXEC",
|
||||
ORTE_NAME_PRINT(ORTE_PROC_MY_NAME));
|
||||
close(sd);
|
||||
return ORTE_ERROR;
|
||||
}
|
||||
|
||||
addrlen = sizeof(struct sockaddr_un);
|
||||
if (bind(sd, (struct sockaddr*)&mca_oob_usock_component.address, addrlen) < 0) {
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user