- xbt_assert(sent_size == fdin_size, "Error while copying %s: only %zd bytes copied instead of %ld (errno: %d -- %s)",
- target.c_str(), sent_size, fdin_size, errno, strerror(errno));
-#else
+ if (sent_size == fdin_size) {
+ close(fdin);
+ close(fdout);
+ return;
+ } else if (sent_size != -1 || errno != ENOSYS) {
+ xbt_die("Error while copying %s: only %zd bytes copied instead of %" PRIdMAX " (errno: %d -- %s)", target.c_str(),
+ sent_size, static_cast<intmax_t>(fdin_size), errno, strerror(errno));
+ }
+#endif
+ // If this point is reached, sendfile() actually is not available. Copy file by hand.