summaryrefslogtreecommitdiff
path: root/sha1_file.c
diff options
context:
space:
mode:
authorEric Wong <normalperson@yhbt.net>2007-01-11 21:43:40 (GMT)
committerJunio C Hamano <junkio@cox.net>2007-01-11 22:49:45 (GMT)
commit3b97fee23df7ec78eea77151fcc0885ec3191950 (patch)
tree7fc738d5d6c108e5a93a9861ecd01f8b7a6ec25d /sha1_file.c
parent9130ac1e1966adb9922e64f645730d0d45383495 (diff)
downloadgit-3b97fee23df7ec78eea77151fcc0885ec3191950.zip
git-3b97fee23df7ec78eea77151fcc0885ec3191950.tar.gz
git-3b97fee23df7ec78eea77151fcc0885ec3191950.tar.bz2
Avoid errors and warnings when attempting to do I/O on zero bytes
Unfortunately, while {read,write}_in_full do take into account zero-sized reads/writes; their die and whine variants do not. I have a repository where there are zero-sized files in the history that was triggering these things. Signed-off-by: Eric Wong <normalperson@yhbt.net> Signed-off-by: Junio C Hamano <junkio@cox.net>
Diffstat (limited to 'sha1_file.c')
-rw-r--r--sha1_file.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/sha1_file.c b/sha1_file.c
index 53e25f2..18dd89b 100644
--- a/sha1_file.c
+++ b/sha1_file.c
@@ -1620,6 +1620,8 @@ static int write_buffer(int fd, const void *buf, size_t len)
{
ssize_t size;
+ if (!len)
+ return 0;
size = write_in_full(fd, buf, len);
if (!size)
return error("file write: disk full");