diff --git a/orte/mca/plm/rsh/plm_rsh_component.c b/orte/mca/plm/rsh/plm_rsh_component.c index fd88c60343..005f6dccd6 100644 --- a/orte/mca/plm/rsh/plm_rsh_component.c +++ b/orte/mca/plm/rsh/plm_rsh_component.c @@ -11,7 +11,7 @@ * All rights reserved. * Copyright (c) 2007 Los Alamos National Security, LLC. All rights * reserved. - * Copyright (c) 2008 Sun Microsystems, Inc. All rights reserved. + * Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved. * Copyright (c) 2009 Cisco Systems, Inc. All rights reserved. * $COPYRIGHT$ * @@ -147,24 +147,25 @@ int orte_plm_rsh_component_query(mca_base_module_t **module, int *priority) { char *tmp; - /* To be absolutely sure that we are under an SGE parallel env */ + /* Check if we are under SGE parallel environment by looking at several + * environment variables. If so, setup the path and argv[0]. */ if (!mca_plm_rsh_component.disable_qrsh && NULL != getenv("SGE_ROOT") && NULL != getenv("ARC") && NULL != getenv("PE_HOSTFILE") && NULL != getenv("JOB_ID")) { - /* setting exec_argv and exec_path for qrsh */ - asprintf(&orte_plm_globals.rsh_agent_path, "%s/bin/%s", getenv("SGE_ROOT"), getenv("ARC")); - asprintf(&tmp, "%s/bin/%s/qrsh", getenv("SGE_ROOT"), getenv("ARC")); + /* setting rsh_agent_path and rsh_agent_argv[0] for qrsh */ + asprintf(&orte_plm_globals.rsh_agent_path, "%s/bin/%s/qrsh", + getenv("SGE_ROOT"), getenv("ARC")); orte_plm_globals.rsh_agent_argv = NULL; - opal_argv_append_nosize(&orte_plm_globals.rsh_agent_argv, tmp); - free(tmp); + opal_argv_append_nosize(&orte_plm_globals.rsh_agent_argv, + orte_plm_globals.rsh_agent_path); /* double check that we have access and permissions for the qrsh agent */ if (NULL == opal_path_findv(orte_plm_globals.rsh_agent_argv[0], X_OK, environ, NULL)) { - OPAL_OUTPUT_VERBOSE((1, orte_plm_globals.output, - "%s plm:rsh: unable to be used: cannot find path " - "or execution permissions not set for launching agent \"%s\"\n", - ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), - orte_plm_globals.rsh_agent_argv[0])); + opal_output_verbose(1, orte_plm_globals.output, + "%s plm:rsh: unable to be used: cannot find path " + "or execution permissions not set for launching agent \"%s\"\n", + ORTE_NAME_PRINT(ORTE_PROC_MY_NAME), + orte_plm_globals.rsh_agent_argv[0]); *module = NULL; return ORTE_ERROR; }