From 2da0210de3e9dbcd22cdff0832f0a626801e8fdd Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Mon, 23 May 2016 15:29:36 -0700 Subject: [PATCH] Fix command line usage when Java user provides the -Djava.library.path=foo options --- orte/orted/orted_submit.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/orte/orted/orted_submit.c b/orte/orted/orted_submit.c index 41d3bf1d16..772b38bff7 100644 --- a/orte/orted/orted_submit.c +++ b/orte/orted/orted_submit.c @@ -1511,14 +1511,23 @@ static int create_app(int argc, char* argv[], found = false; for (i=1; NULL != app->argv[i]; i++) { if (NULL != strstr(app->argv[i], "java.library.path")) { + char *dptr; + /* find the '=' that delineates the option from the path */ + if (NULL == (dptr = strchr(app->argv[i], '='))) { + /* that's just wrong */ + rc = ORTE_ERR_BAD_PARAM; + goto cleanup; + } + /* step over the '=' */ + ++dptr; /* yep - but does it include the path to the mpi libs? */ found = true; if (NULL == strstr(app->argv[i], opal_install_dirs.libdir)) { /* doesn't appear to - add it to be safe */ if (':' == app->argv[i][strlen(app->argv[i]-1)]) { - asprintf(&value, "-Djava.library.path=%s%s", app->argv[i], opal_install_dirs.libdir); + asprintf(&value, "-Djava.library.path=%s%s", dptr, opal_install_dirs.libdir); } else { - asprintf(&value, "-Djava.library.path=%s:%s", app->argv[i], opal_install_dirs.libdir); + asprintf(&value, "-Djava.library.path=%s:%s", dptr, opal_install_dirs.libdir); } free(app->argv[i]); app->argv[i] = value;