From efcaef74d87786a60975f68c1ff17b9982731ff8 Mon Sep 17 00:00:00 2001 From: Jeff Squyres Date: Sun, 23 Dec 2018 13:00:01 -0800 Subject: [PATCH] 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 --- ompi/mpi/c/type_set_name.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/ompi/mpi/c/type_set_name.c b/ompi/mpi/c/type_set_name.c index ed5f06d403..ccb8ed195d 100644 --- a/ompi/mpi/c/type_set_name.c +++ b/ompi/mpi/c/type_set_name.c @@ -47,8 +47,6 @@ static const char FUNC_NAME[] = "MPI_Type_set_name"; int MPI_Type_set_name (MPI_Datatype type, const char *type_name) { - int length; - MEMCHECKER( memchecker_datatype(type); ); @@ -65,10 +63,6 @@ int MPI_Type_set_name (MPI_Datatype type, const char *type_name) } memset(type->name, 0, MPI_MAX_OBJECT_NAME); - length = (int)strlen( type_name ); - if( length >= MPI_MAX_OBJECT_NAME ) { - length = MPI_MAX_OBJECT_NAME - 1; - } - opal_string_copy( type->name, type_name, length ); + opal_string_copy( type->name, type_name, MPI_MAX_OBJECT_NAME); return MPI_SUCCESS; }