Merge pull request #4620 from rhc54/topic/closefd
Close the shmemfd to avoid leaking it
Этот коммит содержится в:
Коммит
6ec4ab57fc
@ -35,6 +35,7 @@
|
|||||||
#include "opal/mca/hwloc/hwloc-internal.h"
|
#include "opal/mca/hwloc/hwloc-internal.h"
|
||||||
#include "opal/mca/pmix/pmix_types.h"
|
#include "opal/mca/pmix/pmix_types.h"
|
||||||
#include "opal/util/argv.h"
|
#include "opal/util/argv.h"
|
||||||
|
#include "opal/util/fd.h"
|
||||||
#include "opal/util/opal_environ.h"
|
#include "opal/util/opal_environ.h"
|
||||||
#include "opal/util/path.h"
|
#include "opal/util/path.h"
|
||||||
|
|
||||||
@ -168,6 +169,8 @@ static int init(void)
|
|||||||
shmemfile = NULL;
|
shmemfile = NULL;
|
||||||
return ORTE_SUCCESS;
|
return ORTE_SUCCESS;
|
||||||
}
|
}
|
||||||
|
/* ensure nobody inherits this fd */
|
||||||
|
opal_fd_set_cloexec(shmemfd);
|
||||||
/* populate the shmem segment with the topology */
|
/* populate the shmem segment with the topology */
|
||||||
if (0 != (rc = hwloc_shmem_topology_write(opal_hwloc_topology, shmemfd, 0,
|
if (0 != (rc = hwloc_shmem_topology_write(opal_hwloc_topology, shmemfd, 0,
|
||||||
(void*)shmemaddr, shmemsize, 0))) {
|
(void*)shmemaddr, shmemsize, 0))) {
|
||||||
@ -177,6 +180,8 @@ static int init(void)
|
|||||||
unlink(shmemfile);
|
unlink(shmemfile);
|
||||||
free(shmemfile);
|
free(shmemfile);
|
||||||
shmemfile = NULL;
|
shmemfile = NULL;
|
||||||
|
close(shmemfd);
|
||||||
|
shmemfd = -1;
|
||||||
return ORTE_SUCCESS;
|
return ORTE_SUCCESS;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -191,6 +196,9 @@ static void finalize(void)
|
|||||||
unlink(shmemfile);
|
unlink(shmemfile);
|
||||||
free(shmemfile);
|
free(shmemfile);
|
||||||
}
|
}
|
||||||
|
if (0 <= shmemfd) {
|
||||||
|
close(shmemfd);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user