diff --git a/ompi/runtime/ompi_mpi_init.c b/ompi/runtime/ompi_mpi_init.c index 33a3a659f8..80eb96a337 100644 --- a/ompi/runtime/ompi_mpi_init.c +++ b/ompi/runtime/ompi_mpi_init.c @@ -386,9 +386,9 @@ int ompi_mpi_init(int argc, char **argv, int requested, int *provided) /* if we were not externally started, then we need to setup * two envars so the MPI_INFO_ENV can get the cmd name - * and argv + * and argv (but only if the user supplied a non-NULL argv!) */ - if (NULL == getenv("OMPI_COMMAND")) { + if (NULL == getenv("OMPI_COMMAND") && NULL != argv && NULL != argv[0]) { asprintf(&cmd, "OMPI_COMMAND=%s", argv[0]); putenv(cmd); }