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

Commit 641b34a

Browse files
author
Ralph Castain
committed
Ensure the command args are correct when user provide -Djava.library.path=foo argument
1 parent 29a58f2 commit 641b34a

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

orte/tools/orterun/orterun.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1635,14 +1635,23 @@ static int create_app(int argc, char* argv[],
16351635
found = false;
16361636
for (i=1; NULL != app->argv[i]; i++) {
16371637
if (NULL != strstr(app->argv[i], "java.library.path")) {
1638+
char *dptr;
1639+
/* find the '=' that delineates the option from the path */
1640+
if (NULL == (dptr = strchr(app->argv[i], '='))) {
1641+
/* that's just wrong */
1642+
rc = ORTE_ERR_BAD_PARAM;
1643+
goto cleanup;
1644+
}
1645+
/* step over the '=' */
1646+
++dptr;
16381647
/* yep - but does it include the path to the mpi libs? */
16391648
found = true;
16401649
if (NULL == strstr(app->argv[i], opal_install_dirs.libdir)) {
16411650
/* doesn't appear to - add it to be safe */
16421651
if (':' == app->argv[i][strlen(app->argv[i]-1)]) {
1643-
asprintf(&value, "-Djava.library.path=%s%s", app->argv[i], opal_install_dirs.libdir);
1652+
asprintf(&value, "-Djava.library.path=%s%s", dptr, opal_install_dirs.libdir);
16441653
} else {
1645-
asprintf(&value, "-Djava.library.path=%s:%s", app->argv[i], opal_install_dirs.libdir);
1654+
asprintf(&value, "-Djava.library.path=%s:%s", dptr, opal_install_dirs.libdir);
16461655
}
16471656
free(app->argv[i]);
16481657
app->argv[i] = value;

0 commit comments

Comments
 (0)