[svn-r11364] Purpose:

Bug fix

Description:
Incorrectly terminated the received string in getenv_all

Solution:
Tasks would incorrectly terminat the environment string they received from the
root task in getenv_all.

They did the equivalent of:

env[strlen(str) + 1] = '\0'.

This resulted in a single "garbage" character inserted
at the end of the string.  This wasn't noticed until now because it seems that on most
platforms this garbage character was a 0 anyway.

This has been corrected to;

env[strlen(str)] = '\0'.


Platforms tested:
Red Storm (where the bug was discovered)
heping (pp)

Misc. update:
This commit is contained in:
Leon Arber 2005-09-07 16:19:06 -05:00
parent 4f52992c86
commit 3280e08b9b

View File

@ -915,7 +915,7 @@ char* getenv_all(MPI_Comm comm, int root, const char* name)
env = (char*) HDrealloc(env, len+1);
MPI_Bcast(env, len, MPI_CHAR, root, comm);
env[len+1] = '\0';
env[len] = '\0';
}
else
{