path: root/csum-file.c
diff options
authorJeff King <>2013-12-21 14:13:25 (GMT)
committerJunio C Hamano <>2013-12-26 19:50:20 (GMT)
commit9af270e8c2a02afd9a3262a2c9312ee7fefbb7a3 (patch)
treecb64ac3da277efb553994e4d9fda5bad1acfbec1 /csum-file.c
parent7794a680e63a2a11b73cb1194653662f2769a792 (diff)
do not pretend sha1write returns errors
The sha1write function returns an int, but it will always be "0". The failure-prone parts of the function happen in the "flush" callback, which cannot pass an error back to us. So we just end up calling die() during the flush. Let's just drop the return value altogether, as it only confuses callers into thinking that it might be useful. Only one call site actually checked the return value. We can drop that check, since it just led to a die() anyway. Signed-off-by: Jeff King <> Signed-off-by: Junio C Hamano <>
Diffstat (limited to 'csum-file.c')
1 files changed, 1 insertions, 2 deletions
diff --git a/csum-file.c b/csum-file.c
index 53f5375..b30e4f2 100644
--- a/csum-file.c
+++ b/csum-file.c
@@ -86,7 +86,7 @@ int sha1close(struct sha1file *f, unsigned char *result, unsigned int flags)
return fd;
-int sha1write(struct sha1file *f, void *buf, unsigned int count)
+void sha1write(struct sha1file *f, void *buf, unsigned int count)
while (count) {
unsigned offset = f->offset;
@@ -116,7 +116,6 @@ int sha1write(struct sha1file *f, void *buf, unsigned int count)
f->offset = offset;
- return 0;
struct sha1file *sha1fd(int fd, const char *name)