diff --git a/ompi/mpi/c/init_thread.c b/ompi/mpi/c/init_thread.c index 29d7bbcd34..b16fbe67c2 100644 --- a/ompi/mpi/c/init_thread.c +++ b/ompi/mpi/c/init_thread.c @@ -37,7 +37,6 @@ int MPI_Init_thread(int *argc, char ***argv, int required, int *provided) { int err; - MPI_Comm null = NULL; OPAL_CR_TEST_CHECKPOINT_READY(); @@ -84,6 +83,16 @@ int MPI_Init_thread(int *argc, char ***argv, int required, } else { err = ompi_mpi_init(0, NULL, required, provided); } - - OMPI_ERRHANDLER_RETURN(err, null, err, FUNC_NAME); + + /* Since we don't have a communicator to invoke an errorhandler on + here, don't use the fancy-schmancy ERRHANDLER macros; they're + really designed for real communicator objects. Just use the + back-end function directly. */ + + if (MPI_SUCCESS != err) { + return ompi_errhandler_invoke(NULL, NULL, OMPI_ERRHANDLER_TYPE_COMM, + err < 0 ? ompi_errcode_get_mpi_code(err) : + err, FUNC_NAME); + } + return MPI_SUCCESS; }