From 360dcd5f50d70134175a5a408f4042061895006d Mon Sep 17 00:00:00 2001 From: Ralph Castain Date: Mon, 13 Aug 2012 18:59:38 +0000 Subject: [PATCH] Protect ompi_info_init from java's sad behavior of removing the cmd from argv This commit was SVN r27020. --- ompi/info/info.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/ompi/info/info.c b/ompi/info/info.c index 4b2558ba16..b7d4880f1a 100644 --- a/ompi/info/info.c +++ b/ompi/info/info.c @@ -107,18 +107,22 @@ int ompi_info_init(int argc, char **argv) } /* Create MPI_INFO_NULL */ - OBJ_CONSTRUCT(&ompi_mpi_info_null.info, ompi_info_t); ompi_mpi_info_null.info.i_f_to_c_index = 0; - /* Create MPI_INFO_GET_ENV */ + /* Create MPI_INFO_ENV */ OBJ_CONSTRUCT(&ompi_mpi_info_env.info, ompi_info_t); ompi_mpi_info_env.info.i_f_to_c_index = 1; - /* fill the get_env info object */ + /* fill the env info object */ /* command for this app_context */ - ompi_info_set(&ompi_mpi_info_env.info, "command", argv[0]); + if (NULL != argv[0]) { + /* Java eats the name of the cmd, so argv will + * be empty + */ + ompi_info_set(&ompi_mpi_info_env.info, "command", argv[0]); + } /* space-separated list of argv for this command */ if (1 < argc) {