Skip to content

Commit

Permalink
hydra/mpiexec: detect missing executables
Browse files Browse the repository at this point in the history
If user invoke mpiexec without executables, currently it will segfault.
Check for this case and provider proper error messages.
  • Loading branch information
hzhou committed Jun 23, 2023
1 parent b578077 commit 4131397
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/pm/hydra/mpiexec/mpiexec.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,14 @@ int main(int argc, char **argv)
status = HYD_uii_mpx_get_parameters(argv);
HYDU_ERR_POP(status, "error parsing parameters\n");

/* Check if any exec argument is missing */
for (exec = HYD_uii_mpx_exec_list; exec; exec = exec->next) {
if (exec->exec[0] == NULL) {
HYDU_ERR_SETANDJUMP(status, HYD_INVALID_PARAM,
"Missing executable. Try -h for usages.\n");
}
}

/* The demux engine should be initialized before any sockets are
* created, since it checks for STDIN's validity. If STDIN was
* closed and we opened a socket that got the same fd as STDIN,
Expand Down

0 comments on commit 4131397

Please sign in to comment.