diff options
| author | Junio C Hamano <junkio@cox.net> | 2005-12-21 00:01:00 -0800 |
|---|---|---|
| committer | Junio C Hamano <junkio@cox.net> | 2005-12-21 00:01:00 -0800 |
| commit | c2f3bf071ee90b01f2d629921bb04c4f798f02fa (patch) | |
| tree | 08ffe5b40e062d596deee47f3869278f4661a858 /copy.c | |
| parent | GIT 0.99.9n aka 1.0rc6 (diff) | |
| parent | Make "git-send-pack" less verbose by default (diff) | |
| download | git-1.0.0.tar.gz git-1.0.0.zip | |
GIT 1.0.0v1.0.0
Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'copy.c')
| -rw-r--r-- | copy.c | 19 |
1 files changed, 7 insertions, 12 deletions
@@ -6,32 +6,27 @@ int copy_fd(int ifd, int ofd) int len; char buffer[8192]; char *buf = buffer; - len = read(ifd, buffer, sizeof(buffer)); + len = xread(ifd, buffer, sizeof(buffer)); if (!len) break; if (len < 0) { int read_error; - if (errno == EAGAIN) - continue; read_error = errno; close(ifd); return error("copy-fd: read returned %s", strerror(read_error)); } - while (1) { - int written = write(ofd, buf, len); + while (len) { + int written = xwrite(ofd, buf, len); if (written > 0) { buf += written; len -= written; - if (!len) - break; } - if (!written) + else if (!written) return error("copy-fd: write returned 0"); - if (errno == EAGAIN || errno == EINTR) - continue; - return error("copy-fd: write returned %s", - strerror(errno)); + else + return error("copy-fd: write returned %s", + strerror(errno)); } } close(ifd); |
