copy.c::copy_fd() - do not leak file descriptor on error return. Signed-off-by: Junio C Hamano <junkio@cox.net>
diff --git a/copy.c b/copy.c index 2009275..e1cd5d0 100644 --- a/copy.c +++ b/copy.c
@@ -10,10 +10,13 @@ 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);