]> git.ipfire.org Git - thirdparty/git.git/commitdiff
Fix git-fast-export for zero-sized blobs
authorAlex Riesen <raa.lkml@gmail.com>
Tue, 11 Dec 2007 22:01:28 +0000 (23:01 +0100)
committerJunio C Hamano <gitster@pobox.com>
Wed, 12 Dec 2007 18:59:22 +0000 (10:59 -0800)
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>
builtin-fast-export.c

index 2136aadfd7831828ee29fbfa9ae7974c65271dee..ef27eee71bdef2cac6f751e07b1da71588989b03 100755 (executable)
@@ -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");