Skip to content
This repository was archived by the owner on Sep 30, 2022. It is now read-only.

Commit d51c2af

Browse files
committed
rsh: robustify the check for plm_rsh_agent default value
Don't strcmp against the default value -- the default value may change over time. Instead, check to see if the MCA var source is not DEFAULT. Signed-off-by: Jeff Squyres <[email protected]> (cherry picked from commit open-mpi/ompi@71ec5cf)
1 parent 0e7f033 commit d51c2af

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

orte/mca/plm/rsh/plm_rsh_component.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
* Copyright (c) 2008-2009 Sun Microsystems, Inc. All rights reserved.
1616
* Copyright (c) 2010 Oracle and/or its affiliates. All rights
1717
* reserved.
18-
* Copyright (c) 2009-2015 Cisco Systems, Inc. All rights reserved.
18+
* Copyright (c) 2009-2016 Cisco Systems, Inc. All rights reserved.
1919
* Copyright (c) 2011 IBM Corporation. All rights reserved.
2020
* Copyright (c) 2015 Intel, Inc. All rights reserved.
2121
* $COPYRIGHT$
@@ -70,6 +70,7 @@ static int rsh_launch_agent_lookup(const char *agent_list, char *path);
7070

7171
/* Local variables */
7272
static char *mca_plm_rsh_delay_string = NULL;
73+
static int agent_var_id = -1;
7374

7475
/*
7576
* Instantiate the public struct with all of our public information
@@ -186,6 +187,7 @@ static int rsh_component_register(void)
186187
&mca_plm_rsh_component.agent);
187188
(void) mca_base_var_register_synonym (var_id, "orte", "pls", NULL, "rsh_agent", MCA_BASE_VAR_SYN_FLAG_DEPRECATED);
188189
(void) mca_base_var_register_synonym (var_id, "orte", "orte", NULL, "rsh_agent", MCA_BASE_VAR_SYN_FLAG_DEPRECATED);
190+
agent_var_id = var_id;
189191

190192
mca_plm_rsh_component.assume_same_shell = true;
191193
var_id = mca_base_component_var_register (c, "assume_same_shell",
@@ -261,7 +263,13 @@ static int rsh_component_query(mca_base_module_t **module, int *priority)
261263
* environment variables. If so, setup the path and argv[0].
262264
* Note that we allow the user to specify the launch agent
263265
* even if they are in a Grid Engine environment */
264-
if (0 == strcmp(mca_plm_rsh_component.agent, "ssh : rsh")) {
266+
int ret;
267+
mca_base_var_source_t source;
268+
ret = mca_base_var_get_value(agent_var_id, NULL, &source, NULL);
269+
if (OPAL_SUCCESS != ret) {
270+
return ret;
271+
}
272+
if (MCA_BASE_VAR_SOURCE_DEFAULT != source) {
265273
if (!mca_plm_rsh_component.disable_qrsh &&
266274
NULL != getenv("SGE_ROOT") && NULL != getenv("ARC") &&
267275
NULL != getenv("PE_HOSTFILE") && NULL != getenv("JOB_ID")) {

0 commit comments

Comments
 (0)