Skip to content

Commit

Permalink
Don't overwrite user's args
Browse files Browse the repository at this point in the history
If the cmd provided to spawn doesn't match
argv0, then assume that the user may have put the argv
for their cmd in the argv array, but not
started with the actual cmd - so add it
to the front of the array

Signed-off-by: Ralph Castain <rhc@pmix.org>
  • Loading branch information
rhc54 committed Mar 16, 2024
1 parent 6473f4c commit 8733b7a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/client/pmix_client_spawn.c
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,11 @@ PMIX_EXPORT pmix_status_t PMIx_Spawn_nb(const pmix_info_t job_info[], size_t nin
tmp = pmix_basename(aptr->cmd);
t2 = pmix_basename(aptr->argv[0]);
if (0 != strcmp(tmp, t2)) {
free(appsptr[n].argv[0]);
appsptr[n].argv[0] = strdup(tmp);
// assume that the user may have put the argv
// for their cmd in the argv array, but not
// started with the actual cmd - so add it
// to the front of the array
PMIx_Argv_prepend_nosize(&appsptr[n].argv, tmp);
}
free(tmp);
free(t2);
Expand Down

0 comments on commit 8733b7a

Please sign in to comment.