Fix git-fast-export for zero-sized blobs
Writing 1 elements of size 0-byte successfully will cause fwrite(3) to return 0, and flagging it as error is a mistake. Signed-off-by: Alex Riesen <raa.lkml@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Alex Riesen committed
Dec 11, 2007 at 23:01 UTC
b0fe0d7258951779b790190b10ca21ffc5573546
1 file changed
+1
-1
builtin-fast-export.c
+1
-1
@@ -103,7 +103,7 @@ static void handle_object(const unsigned char *sha1)
103
mark_object(object);
104
105
printf("blob\nmark :%d\ndata %lu\n", last_idnum, size);
106
- if (fwrite(buf, size, 1, stdout) != 1)
106
+ if (size && fwrite(buf, size, 1, stdout) != 1)
107
die ("Could not write blob %s", sha1_to_hex(sha1));
108
printf("\n");
109