X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=copy.c;h=e1cd5d06503d93f6b400a3911e6b61ff327190ca;hb=b17e659dd4007cb1d3eb5ac32b524c0c5ab59601;hp=20092757d395dfa4af99a6062e5e2cc0fa5e00c3;hpb=1301c6eb412e7c5511b952a12e42c70ad56f028b;p=git.git diff --git a/copy.c b/copy.c index 20092757..e1cd5d06 100644 --- a/copy.c +++ b/copy.c @@ -10,10 +10,13 @@ int copy_fd(int ifd, int ofd) 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(errno)); + strerror(read_error)); } while (1) { int written = write(ofd, buf, len);