Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
check that the sendfile worked correctly or die verbosely if not
authorMartin Quinson <martin.quinson@loria.fr>
Fri, 21 Apr 2017 16:20:24 +0000 (18:20 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Fri, 21 Apr 2017 16:20:24 +0000 (18:20 +0200)
src/smpi/smpi_global.cpp

index ff7c129..13d7a16 100644 (file)
@@ -573,7 +573,10 @@ int smpi_main(const char* executable, int argc, char *argv[])
         xbt_assert(fdout >= 0, "Cannot write into %s", target_executable.c_str());
 
 #if HAVE_SENDFILE
         xbt_assert(fdout >= 0, "Cannot write into %s", target_executable.c_str());
 
 #if HAVE_SENDFILE
-        sendfile(fdout, fdin, NULL, fdin_size);
+        ssize_t sent_size = sendfile(fdout, fdin, NULL, fdin_size);
+        xbt_assert(sent_size == fdin_size,
+                   "Error while copying %s: only %ld bytes copied instead of %ld (errno: %d -- %s)",
+                   target_executable.c_str(), sent_size, fdin_size, errno, strerror(errno));
 #else
         XBT_WARN("Copy %d bytes into %s", static_cast<int>(fdin_size), target_executable.c_str());
         const int bufsize = 1024 * 1024 * 4;
 #else
         XBT_WARN("Copy %d bytes into %s", static_cast<int>(fdin_size), target_executable.c_str());
         const int bufsize = 1024 * 1024 * 4;