[MPICH] null termination of MPI_Comm_get_name ?

Toon Knapen toon.knapen at fft.be
Wed Jul 11 10:52:11 CDT 2007


Hi all,

In noticed that the test in test/mpi/comm/commname.c in mpich2-1.0.5p4 
compares what is returned by MPI_Comm_get_name (nameout) using the 
function 'strcmp'.

However by using 'strcmp', the test relies on nameout[rlen] being a 
null-terminator.

In my understanding of the standard however this is not the case. It is 
documented that the length of the name in C may only be 
MPI_MAX_OBJECT_NAME to be able to store the null terminator.

So I would suggest to use 'strncmp' in the test. This has the extra 
advantage that the test also tests the rlen value that is returned by 
MPI_Comm_get_name (which is currently not the case).

toon




More information about the mpich-discuss mailing list