Skip to content

Commit

Permalink
Use exit macros in example dmodex.
Browse files Browse the repository at this point in the history
* Use exit macros in example dmodex
* correct exit status in error paths

Signed-off-by: Samuel K. Gutierrez <samuel@lanl.gov>
(cherry picked from commit 2b91998)
  • Loading branch information
samuelkgutierrez authored and rhc54 committed Feb 9, 2023
1 parent 8f1a613 commit 8d1e5ab
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions examples/dmodex.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ int main(int argc, char **argv)
if (PMIX_SUCCESS != (rc = PMIx_Init(&myproc, NULL, 0))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Init failed: %d\n", myproc.nspace, myproc.rank,
rc);
exit(0);
exit(EXIT_FAILURE);
}

/* get our job size */
Expand Down Expand Up @@ -148,7 +148,7 @@ int main(int argc, char **argv)
np = snprintf(proc.nspace, PMIX_MAX_NSLEN, "%s", myproc.nspace);
if (np >= PMIX_MAX_NSLEN) {
fprintf(stderr, "Client ns %s rank %d: snprintf failed\n", myproc.nspace, myproc.rank);
exit(0);
exit(EXIT_FAILURE);
}

PMIX_INFO_LOAD(&timeout, PMIX_TIMEOUT, &tlimit, PMIX_INT);
Expand Down Expand Up @@ -242,7 +242,7 @@ int main(int argc, char **argv)
if (PMIX_SUCCESS != (rc = PMIx_Fence(NULL, 0, NULL, 0))) {
fprintf(stderr, "Client ns %s rank %d: PMIx_Fence failed: %d\n", myproc.nspace, myproc.rank,
rc);
exit(1);
exit(EXIT_FAILURE);
}

if (PMIX_SUCCESS != (rc = PMIx_Finalize(NULL, 0))) {
Expand All @@ -255,5 +255,5 @@ int main(int argc, char **argv)
}
}
fflush(stderr);
return (0);
return (EXIT_SUCCESS);
}

0 comments on commit 8d1e5ab

Please sign in to comment.