Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--copy.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/copy.c b/copy.c
index 7100eedbc3..08a3d388a4 100644
--- a/copy.c
+++ b/copy.c
@@ -22,11 +22,14 @@ int copy_fd(int ifd, int ofd)
buf += written;
len -= written;
}
- else if (!written)
+ else if (!written) {
+ close(ifd);
return error("copy-fd: write returned 0");
- else
+ } else {
+ close(ifd);
return error("copy-fd: write returned %s",
strerror(errno));
+ }
}
}
close(ifd);