Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[sonar] Avoid C-style array.
[simgrid.git] / src / smpi / mpi / smpi_comm.cpp
index 017d010..2dceee2 100644 (file)
@@ -183,12 +183,12 @@ void Comm::get_name(char* name, int* len) const
 std::string Comm::name() const
 {
   int size;
-  char name[MPI_MAX_NAME_STRING+1];
-  this->get_name(name, &size);
+  std::array<char, MPI_MAX_NAME_STRING + 1> name;
+  this->get_name(name.data(), &size);
   if (name[0]=='\0')
     return std::string("MPI_Comm");
   else
-    return std::string(name);
+    return std::string(name.data());
 }
 
 
@@ -583,9 +583,12 @@ MPI_Errhandler Comm::errhandler()
       errhandler_->ref();
     return errhandler_;
   } else {
-    if(errhandlers_==nullptr)
-      return MPI_ERRORS_ARE_FATAL;
-    else {
+    if(errhandlers_==nullptr){
+      if (_smpi_cfg_default_errhandler_is_error)
+        return MPI_ERRORS_ARE_FATAL;
+      else
+        return MPI_ERRORS_RETURN;
+    } else {
       if(errhandlers_[this->rank()] != MPI_ERRHANDLER_NULL)
         errhandlers_[this->rank()]->ref();
       return errhandlers_[this->rank()];