From f28448702aeb0a052ac2af985d4ffa57d1a7448f Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Tue, 22 Sep 2015 07:24:54 -0700 Subject: [PATCH] Eliminate malloc by utilizing /proc/self/fd - optimization --- orte/mca/odls/default/odls_default_module.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/orte/mca/odls/default/odls_default_module.c b/orte/mca/odls/default/odls_default_module.c index 6b22213191..48548b34a2 100644 --- a/orte/mca/odls/default/odls_default_module.c +++ b/orte/mca/odls/default/odls_default_module.c @@ -359,14 +359,7 @@ static void send_error_show_help(int fd, int exit_status, the parent. */ static int close_open_file_descriptors(int write_fd, orte_iof_base_io_conf_t opts) { - int pid = getpid(); - char *fds_dir = NULL; - int rc = asprintf(&fds_dir, "/proc/%d/fd", pid); - if (rc < 0) { - return ORTE_ERR_OUT_OF_RESOURCE; - } - DIR *dir = opendir(fds_dir); - free(fds_dir); + DIR *dir = opendir("/proc/self/fd"); if (NULL == dir) { return ORTE_ERR_FILE_OPEN_FAILURE; }