From e2aaf64239a84b4bf16fe9c0330b12396a05148b Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Sat, 28 Aug 2004 16:30:29 +0000 Subject: [PATCH] Add a few checks to ensure that MPI_INIT(NULL, NULL) and MPI_INIT_THREAD(NULL, NULL, ...) will work properly. This commit was SVN r2362. --- src/mpi/c/init.c | 6 +++++- src/mpi/c/init_thread.c | 6 +++++- src/util/cmd_line.c | 6 ++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/mpi/c/init.c b/src/mpi/c/init.c index 95fdce8c55..d2f19b4d5b 100644 --- a/src/mpi/c/init.c +++ b/src/mpi/c/init.c @@ -58,6 +58,10 @@ int MPI_Init(int *argc, char ***argv) little in this function as possible so that if it's profiled, we don't lose anything) */ - err = ompi_mpi_init(*argc, *argv, required, &provided); + if (NULL != argc && NULL != argv) { + err = ompi_mpi_init(*argc, *argv, required, &provided); + } else { + err = ompi_mpi_init(NULL, NULL, required, &provided); + } OMPI_ERRHANDLER_RETURN(err, null, err, FUNC_NAME); } diff --git a/src/mpi/c/init_thread.c b/src/mpi/c/init_thread.c index 842010f466..27d99badbd 100644 --- a/src/mpi/c/init_thread.c +++ b/src/mpi/c/init_thread.c @@ -42,6 +42,10 @@ int MPI_Init_thread(int *argc, char ***argv, int required, little in this function as possible so that if it's profiled, we don't lose anything) */ - err = ompi_mpi_init(*argc, *argv, required, provided); + if (NULL != argc && NULL != argv) { + err = ompi_mpi_init(*argc, *argv, required, provided); + } else { + err = ompi_mpi_init(NULL, NULL, required, provided); + } OMPI_ERRHANDLER_RETURN(err, null, err, FUNC_NAME); } diff --git a/src/util/cmd_line.c b/src/util/cmd_line.c index 452510fc89..f7e490fbd5 100644 --- a/src/util/cmd_line.c +++ b/src/util/cmd_line.c @@ -171,6 +171,12 @@ int ompi_cmd_line_parse(ompi_cmd_line_t *cmd, bool ignore_unknown, bool is_unknown; bool is_option; + /* Bozo check */ + + if (0 == argc || NULL == argv) { + return OMPI_SUCCESS; + } + /* Thread serialization */ ompi_mutex_lock(&cmd->lcl_mutex);