From e406a4b1aac65e3223e1850748ff0085049e841e Mon Sep 17 00:00:00 2001 From: Tim Woodall Date: Thu, 2 Jun 2005 19:17:32 +0000 Subject: [PATCH] corrections for stdin - stdin shouldn't be using same pty as stdout - corrects duplicate output This commit was SVN r5925. --- src/mca/iof/base/iof_base_setup.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/mca/iof/base/iof_base_setup.c b/src/mca/iof/base/iof_base_setup.c index 484f8f8eea..10d6fcc2bb 100644 --- a/src/mca/iof/base/iof_base_setup.c +++ b/src/mca/iof/base/iof_base_setup.c @@ -61,11 +61,13 @@ orte_iof_base_setup_prefork(orte_iof_base_io_conf_t *opts) #endif fflush(stdout); - #if defined(HAVE_OPENPTY) && OMPI_ENABLE_PTY_SUPPORT + if (opts->usepty) { ret = openpty(&(opts->p_stdout[0]), &(opts->p_stdout[1]), NULL, NULL, NULL); + ret = openpty(&(opts->p_stdin[0]), &(opts->p_stdin[1]), + NULL, NULL, NULL); } else { ret = -1; } @@ -105,7 +107,7 @@ orte_iof_base_setup_child(orte_iof_base_io_conf_t *opts) { int ret; - if (! opts->usepty) { + if (!opts->usepty) { close(opts->p_stdout[0]); close(opts->p_stdin[1]); } @@ -113,7 +115,7 @@ orte_iof_base_setup_child(orte_iof_base_io_conf_t *opts) if (opts->usepty) { if (opts->connect_stdin) { - ret = dup2(opts->p_stdout[1], fileno(stdin)); + ret = dup2(opts->p_stdin[0], fileno(stdin)); if (ret < 0) return OMPI_ERROR; } else { int fd; @@ -134,9 +136,9 @@ orte_iof_base_setup_child(orte_iof_base_io_conf_t *opts) } if (opts->connect_stdin) { if(opts->p_stdin[0] != fileno(stdin)) { - ret = dup2(opts->p_stdin[1], fileno(stdin)); + ret = dup2(opts->p_stdin[0], fileno(stdin)); if (ret < 0) return OMPI_ERROR; - close(opts->p_stdin[1]); + close(opts->p_stdin[0]); } } else { int fd; @@ -155,7 +157,6 @@ orte_iof_base_setup_child(orte_iof_base_io_conf_t *opts) if (ret < 0) return OMPI_ERROR; close(opts->p_stderr[1]); } - return OMPI_SUCCESS; } @@ -172,11 +173,10 @@ orte_iof_base_setup_parent(const orte_process_name_t* name, } close(opts->p_stderr[1]); - /* connect stdin endpoint */ + /* connect write end to IOF */ if (opts->connect_stdin) { ret = orte_iof.iof_publish(name, ORTE_IOF_SINK, - ORTE_IOF_STDIN, opts->usepty ? - opts->p_stdout[0] : opts->p_stdin[1]); + ORTE_IOF_STDIN, opts->p_stdin[1]); if(ORTE_SUCCESS != ret) { ORTE_ERROR_LOG(ret); return ret;