diff options
author | Nate Straz <nstraz@redhat.com> | 2006-11-16 04:56:46 +0000 |
---|---|---|
committer | Nathan Straz <nstraz@redhat.com> | 2008-09-23 09:37:46 -0400 |
commit | aaf5cb39094bf87ac895210c4cf7f27d4483a3b9 (patch) | |
tree | e59ef496a2927ccfcab76b9c360045855a27a452 /qacp.c | |
parent | 9fc82fc82e7248a598b8c8bedd86cecb3c10d1e9 (diff) | |
download | qarsh-aaf5cb39094bf87ac895210c4cf7f27d4483a3b9.tar.gz qarsh-aaf5cb39094bf87ac895210c4cf7f27d4483a3b9.tar.xz qarsh-aaf5cb39094bf87ac895210c4cf7f27d4483a3b9.zip |
sendfile() can only send about 2GB, but you can keep calling it until
everything is sent.
Diffstat (limited to 'qacp.c')
-rw-r--r-- | qacp.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -160,7 +160,9 @@ qacp_sendonefile(const char *host, const char *srcfile, const char *destfile) dlen = sizeof daddr; outsd = accept(sd, (struct sockaddr *) &daddr, &dlen); - nbytes = sendfile(outsd, fd, &offset, sb.st_size); + do { + nbytes = sendfile(outsd, fd, &offset, sb.st_size); + } while (nbytes >= 0 && offset < sb.st_size); if (nbytes == -1 && errno == EINVAL) { fprintf(stderr, "Falling back to reads\n"); @@ -186,7 +188,7 @@ qacp_sendonefile(const char *host, const char *srcfile, const char *destfile) } write(outsd, fallbackbuf, nbytes); } while (nbytes > 0); - } else { + } else if (nbytes == -1) { fprintf(stderr, "error: %s\n", strerror(errno)); } sendone_failure: |