diff --git a/orte/mca/plm/rsh/plm_rsh_module.c b/orte/mca/plm/rsh/plm_rsh_module.c index 5b5f353634..492e898be8 100644 --- a/orte/mca/plm/rsh/plm_rsh_module.c +++ b/orte/mca/plm/rsh/plm_rsh_module.c @@ -572,18 +572,15 @@ static int setup_launch(int *argcptr, char ***argvptr, */ cnt = opal_argv_count(orted_cmd_line); for (i=0; i < cnt; i+=3) { - /* check if the specified option is more than one word - all - * others have already been passed - */ - if (NULL != strchr(orted_cmd_line[i+2], ' ')) { - /* must add quotes around it */ - (void)asprintf(¶m, "\"%s\"", orted_cmd_line[i+2]); - /* now pass it along */ - opal_argv_append(&argc, &argv, orted_cmd_line[i]); - opal_argv_append(&argc, &argv, orted_cmd_line[i+1]); - opal_argv_append(&argc, &argv, param); - free(param); - } + /* there could be multi-word values here, or + * values with special characters, so protect + * the value with quotes */ + (void)asprintf(¶m, "\"%s\"", orted_cmd_line[i+2]); + /* now pass it along */ + opal_argv_append(&argc, &argv, orted_cmd_line[i]); + opal_argv_append(&argc, &argv, orted_cmd_line[i+1]); + opal_argv_append(&argc, &argv, param); + free(param); } /* unless told otherwise... */ @@ -612,20 +609,16 @@ static int setup_launch(int *argcptr, char ***argvptr, } } if (!found) { + char *p2; /* add it */ opal_argv_append(&argc, &argv, "-mca"); opal_argv_append(&argc, &argv, param); - /* if the value has a special character in it, - * then protect it with quotes - */ - if (NULL != strchr(value, ';')) { - char *p2; - (void)asprintf(&p2, "\"%s\"", value); - opal_argv_append(&argc, &argv, p2); - free(p2); - } else { - opal_argv_append(&argc, &argv, value); - } + /* there could be multi-word values here, or + * values with special characters, so protect + * the value with quotes */ + (void)asprintf(&p2, "\"%s\"", value); + opal_argv_append(&argc, &argv, p2); + free(p2); } free(param); }