Skip to content

Commit efcaef7

Browse files
committed
MPI_Type_set_name: fix string length at target
opal_string_copy() takes care of all the string computations. Specifically: when we converted to opal_string_copy(), we accidentally left the *source* length as the argument, not the *target* length, which resulted in one less character being copied than intended (as was showing up in MTT C++ testing results). Signed-off-by: Jeff Squyres <jsquyres@cisco.com>
1 parent d2e3b03 commit efcaef7

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

ompi/mpi/c/type_set_name.c

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@ static const char FUNC_NAME[] = "MPI_Type_set_name";
4747

4848
int MPI_Type_set_name (MPI_Datatype type, const char *type_name)
4949
{
50-
int length;
51-
5250
MEMCHECKER(
5351
memchecker_datatype(type);
5452
);
@@ -65,10 +63,6 @@ int MPI_Type_set_name (MPI_Datatype type, const char *type_name)
6563
}
6664

6765
memset(type->name, 0, MPI_MAX_OBJECT_NAME);
68-
length = (int)strlen( type_name );
69-
if( length >= MPI_MAX_OBJECT_NAME ) {
70-
length = MPI_MAX_OBJECT_NAME - 1;
71-
}
72-
opal_string_copy( type->name, type_name, length );
66+
opal_string_copy( type->name, type_name, MPI_MAX_OBJECT_NAME);
7367
return MPI_SUCCESS;
7468
}

0 commit comments

Comments
 (0)