fixed a bug in MPI_Print (fortran version). Creating a buffer for printing by ap
authorGengbin Zheng <gzheng@illinois.edu>
Wed, 21 Dec 2005 02:55:22 +0000 (02:55 +0000)
committerGengbin Zheng <gzheng@illinois.edu>
Wed, 21 Dec 2005 02:55:22 +0000 (02:55 +0000)
pying the traling '\0'.

src/libs/ck-libs/ampi/ampif.C

index 4afc99daad4de85af9affc2b0dab0adfa6d596fa..ec91e20b1cbeb3bd9ab4ce3b727d7ec4dfaea4dd 100644 (file)
@@ -806,8 +806,11 @@ void mpi_get_count(int *sts, int *dtype, int *cnt, int *ierr)
 
 void mpi_print(char *str, int *len)
 {
-  str[*len] = '\0';
-  AMPI_Print(str);
+  char *buf = new char[*len+1];
+  memcpy(buf, str, *len);
+  buf[*len] = '\0';
+  AMPI_Print(buf);
+  delete [] buf;
 }
 
 void mpi_migrate(void)