From 414a87b14cf407f76b1f7c2ab4521f4f160f63cb Mon Sep 17 00:00:00 2001 From: Brian Barrett Date: Mon, 18 Dec 2006 02:30:05 +0000 Subject: [PATCH] On OS X, the lowest 8 bits of the exit status are for signals, so pushing rc (which is -1 or 4 if we hit this case) resulted in an odd error that a signal killed the proc (instead of a startup error, as is reality). Instead, use the W_EXITCODE macro (if available) to build up an exit code that has an error code for exit status, but does not make it look like the process died from a signal This commit was SVN r12890. --- orte/mca/odls/default/odls_default_module.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/orte/mca/odls/default/odls_default_module.c b/orte/mca/odls/default/odls_default_module.c index 727f05b2ee..f46e6ffd33 100644 --- a/orte/mca/odls/default/odls_default_module.c +++ b/orte/mca/odls/default/odls_default_module.c @@ -701,12 +701,12 @@ static int odls_default_fork_local_proc( if (ORTE_SUCCESS != (i = orte_rmgr.check_context_cwd(context, true))) { /* Tell the parent that Badness happened */ write(p[1], &i, sizeof(int)); - exit(-1); + exit(1); } if (ORTE_SUCCESS != (i = orte_rmgr.check_context_app(context))) { /* Tell the parent that Badness happened */ write(p[1], &i, sizeof(int)); - exit(-1); + exit(1); } /* setup base environment: copy the current environ and merge @@ -866,7 +866,7 @@ static int odls_default_fork_local_proc( execve(context->app, context->argv, environ_copy); opal_show_help("help-odls-default.txt", "orte-odls-default:execv-error", true, context->app, strerror(errno)); - exit(-1); + exit(1); } else { /* connect endpoints IOF */ @@ -892,12 +892,18 @@ static int odls_default_fork_local_proc( /* Child was successful in exec'ing! */ break; } else { + int exit_code; /* Doh -- child failed. Report the failure to launch this process through the SOH or else everyone else will hang. Don't bother checking whether or not this worked - just fire and forget */ - orte_smr.set_proc_state(child->name, ORTE_PROC_STATE_ABORTED, rc); +#ifdef W_EXITCODE + exit_code = W_EXITCODE((0xFF & i), 0); +#else + exit_code = (0xFF & i); +#endif + orte_smr.set_proc_state(child->name, ORTE_PROC_STATE_ABORTED, exit_code); return ORTE_ERR_FATAL; break; }