Skip to content

Commit 8d2d5ef

Browse files
author
rhc54
committed
Merge pull request #1691 from rhc54/topic/java
Fix command line usage when Java user provides the -Djava.library.path=foo options
2 parents a651f26 + 2da0210 commit 8d2d5ef

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

orte/orted/orted_submit.c

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1511,14 +1511,23 @@ static int create_app(int argc, char* argv[],
15111511
found = false;
15121512
for (i=1; NULL != app->argv[i]; i++) {
15131513
if (NULL != strstr(app->argv[i], "java.library.path")) {
1514+
char *dptr;
1515+
/* find the '=' that delineates the option from the path */
1516+
if (NULL == (dptr = strchr(app->argv[i], '='))) {
1517+
/* that's just wrong */
1518+
rc = ORTE_ERR_BAD_PARAM;
1519+
goto cleanup;
1520+
}
1521+
/* step over the '=' */
1522+
++dptr;
15141523
/* yep - but does it include the path to the mpi libs? */
15151524
found = true;
15161525
if (NULL == strstr(app->argv[i], opal_install_dirs.libdir)) {
15171526
/* doesn't appear to - add it to be safe */
15181527
if (':' == app->argv[i][strlen(app->argv[i]-1)]) {
1519-
asprintf(&value, "-Djava.library.path=%s%s", app->argv[i], opal_install_dirs.libdir);
1528+
asprintf(&value, "-Djava.library.path=%s%s", dptr, opal_install_dirs.libdir);
15201529
} else {
1521-
asprintf(&value, "-Djava.library.path=%s:%s", app->argv[i], opal_install_dirs.libdir);
1530+
asprintf(&value, "-Djava.library.path=%s:%s", dptr, opal_install_dirs.libdir);
15221531
}
15231532
free(app->argv[i]);
15241533
app->argv[i] = value;

0 commit comments

Comments
 (0)