File tree Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Expand file tree Collapse file tree 1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change 3535#include "opal/mca/hwloc/hwloc-internal.h"
3636#include "opal/mca/pmix/pmix_types.h"
3737#include "opal/util/argv.h"
38+ #include "opal/util/fd.h"
3839#include "opal/util/opal_environ.h"
3940#include "opal/util/path.h"
4041
@@ -168,6 +169,8 @@ static int init(void)
168169 shmemfile = NULL ;
169170 return ORTE_SUCCESS ;
170171 }
172+ /* ensure nobody inherits this fd */
173+ opal_fd_set_cloexec (shmemfd );
171174 /* populate the shmem segment with the topology */
172175 if (0 != (rc = hwloc_shmem_topology_write (opal_hwloc_topology , shmemfd , 0 ,
173176 (void * )shmemaddr , shmemsize , 0 ))) {
@@ -177,6 +180,8 @@ static int init(void)
177180 unlink (shmemfile );
178181 free (shmemfile );
179182 shmemfile = NULL ;
183+ close (shmemfd );
184+ shmemfd = -1 ;
180185 return ORTE_SUCCESS ;
181186 }
182187#endif
@@ -191,6 +196,9 @@ static void finalize(void)
191196 unlink (shmemfile );
192197 free (shmemfile );
193198 }
199+ if (0 <= shmemfd ) {
200+ close (shmemfd );
201+ }
194202#endif
195203 return ;
196204}
You can’t perform that action at this time.
0 commit comments