Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Avoid returning uninitialized bytes in fortran processor names.
authordegomme <adegomme@users.noreply.github.com>
Wed, 10 Apr 2019 09:25:33 +0000 (11:25 +0200)
committerdegomme <adegomme@users.noreply.github.com>
Mon, 15 Apr 2019 07:54:54 +0000 (09:54 +0200)
src/smpi/bindings/smpi_f77.cpp

index 0c25e44..e4d56c7 100644 (file)
@@ -107,6 +107,8 @@ void mpi_initialized_(int* flag, int* ierr){
 }
 
 void mpi_get_processor_name_(char *name, int *resultlen, int* ierr){
+  //fortran does not handle string endings cleanly, so initialize everything before
+  sprintf(name,"%*c\n", MPI_MAX_PROCESSOR_NAME,' ');
   *ierr = MPI_Get_processor_name(name, resultlen);
 }