From: Martin Quinson Date: Fri, 21 Apr 2017 16:20:24 +0000 (+0200) Subject: check that the sendfile worked correctly or die verbosely if not X-Git-Tag: v3.16~322 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/b6f24acb59f28c9da5156f8afe49ea330d71be91 check that the sendfile worked correctly or die verbosely if not --- diff --git a/src/smpi/smpi_global.cpp b/src/smpi/smpi_global.cpp index ff7c129f1b..13d7a16c01 100644 --- a/src/smpi/smpi_global.cpp +++ b/src/smpi/smpi_global.cpp @@ -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 - 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(fdin_size), target_executable.c_str()); const int bufsize = 1024 * 1024 * 4;