- if (slow_copy) {
- const int bufsize = 1024 * 1024 * 4;
- char buf[bufsize];
- while (int got = read(fdin, buf, bufsize)) {
- if (got == -1) {
- xbt_assert(errno == EINTR, "Cannot read from %s", src.c_str());
- } else {
- char* p = buf;
- int todo = got;
- while (int done = write(fdout, p, todo)) {
- if (done == -1) {
- xbt_assert(errno == EINTR, "Cannot write into %s", target.c_str());
- } else {
- p += done;
- todo -= done;
- }
+ // If this point is reached, sendfile() actually is not available. Copy file by hand.
+ const int bufsize = 1024 * 1024 * 4;
+ char* buf = new char[bufsize];
+ while (int got = read(fdin, buf, bufsize)) {
+ if (got == -1) {
+ xbt_assert(errno == EINTR, "Cannot read from %s", src.c_str());
+ } else {
+ char* p = buf;
+ int todo = got;
+ while (int done = write(fdout, p, todo)) {
+ if (done == -1) {
+ xbt_assert(errno == EINTR, "Cannot write into %s", target.c_str());
+ } else {
+ p += done;
+ todo -= done;