Looks OK to me.
Brice
Le 23/04/2014 23:05, Jeff Squyres (jsquyres) a écrit :
Any objections to this patch? In OMPI, we're seeing this fd leak into child
processes.
diff --git a/src/topology-linux.c b/src/topology-linux.c
index e934d4c..8c5fba1 100644
--- a/src/topology-linux.c
+++ b/src/topology-linux.c
@@ -4601,6 +4601,13 @@ hwloc_linux_component_instantiate(struct hwloc_disc_compo
data->is_real_fsroot = 0;
}
+ /* Since this fd stays open after hwloc returns, mark it as
+ close-on-exec so that children don't inherit it */
+ if (fcntl(root, F_SETFD, FD_CLOEXEC) == -1) {
+ close(root);
+ root = -1;
+ goto out_with_data;
+ }
#else
if (strcmp(fsroot_path, "/")) {
errno = ENOSYS;