Skip to content

Commit

Permalink
Fix git-fast-export for zero-sized blobs
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Alex Riesen authored and Junio C Hamano committed Dec 12, 2007
1 parent d4110a9 commit b0fe0d7
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion builtin-fast-export.c
Original file line number Diff line number Diff line change
Expand Up @@ -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");

Expand Down

0 comments on commit b0fe0d7

Please sign in to comment.