From: Alex Riesen Date: Tue, 11 Dec 2007 22:01:28 +0000 (+0100) Subject: Fix git-fast-export for zero-sized blobs X-Git-Tag: v1.5.4-rc0~13 X-Git-Url: https://git.lorimer.id.au/gitweb.git/diff_plain/b0fe0d7258951779b790190b10ca21ffc5573546 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 Signed-off-by: Junio C Hamano --- diff --git a/builtin-fast-export.c b/builtin-fast-export.c index 2136aadfd7..ef27eee71b 100755 --- a/builtin-fast-export.c +++ b/builtin-fast-export.c @@ -103,7 +103,7 @@ static void handle_object(const unsigned char *sha1) mark_object(object); printf("blob\nmark :%d\ndata %lu\n", last_idnum, size); - if (fwrite(buf, size, 1, stdout) != 1) + if (size && fwrite(buf, size, 1, stdout) != 1) die ("Could not write blob %s", sha1_to_hex(sha1)); printf("\n");