From a0abf45372e8b55e68f929a63ebf04c6912c969e Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Tue, 17 Aug 2004 03:02:01 +0000 Subject: [PATCH] Ensure to return the right status -- strip the exit status out of the return code from waitpid(). For example, in some cases, when gcc fails to compile the app for some reason, it returns an error status of 1, which is a return code of 256. If we return 256 from main(), only the lower 8 bits are returned which results in a 0 return status from the wrapper compiler (doh!). So be sure that we properly strip out the correct return status from the underlying compiler and return only those 8 bits through main(). This commit was SVN r2175. --- src/tools/wrappers/wrap.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/tools/wrappers/wrap.cc b/src/tools/wrappers/wrap.cc index 8f683ac572..914b7f9198 100644 --- a/src/tools/wrappers/wrap.cc +++ b/src/tools/wrappers/wrap.cc @@ -483,6 +483,10 @@ ompi_wrap_exec_sv(const ompi_sv_t& sv) } else { free(tmp); ret = ompi_few(av, &status); + status = WIFEXITED(status) ? WEXITSTATUS(status) : + (WIFSIGNALED(status) ? WTERMSIG(status) : + (WIFSTOPPED(status) ? WSTOPSIG(status) : 255)); + if (0 != ret && 0 != errno && fl_want_show_error) { perror(cmd_name.c_str()); }