From b6f24acb59f28c9da5156f8afe49ea330d71be91 Mon Sep 17 00:00:00 2001 From: Martin Quinson Date: Fri, 21 Apr 2017 18:20:24 +0200 Subject: [PATCH] check that the sendfile worked correctly or die verbosely if not --- src/smpi/smpi_global.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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; -- 2.20.1