@matheusbsbs / matheus-bagliano / commits / 7561d9f544
Fork 0

commit-tree: check return value from write_sha1_file()

... found by Matthias Kestenholz. Signed-off-by: Junio C Hamano <junkio@cox.net>

Junio C Hamano committed Mar 24, 2006 at 22:23 UTC 7561d9f54412fcf443ebb28040bad67cd054a986
1 file changed +6 -3
commit-tree.c
+6 -3
@@ -125,7 +125,10 @@ int main(int argc, char **argv)
125 while (fgets(comment, sizeof(comment), stdin) != NULL)
126 add_buffer(&buffer, &size, "%s", comment);
127
128 - write_sha1_file(buffer, size, "commit", commit_sha1);
129 - printf("%s\n", sha1_to_hex(commit_sha1));
130 - return 0;
128 + if (!write_sha1_file(buffer, size, "commit", commit_sha1)) {
129 + printf("%s\n", sha1_to_hex(commit_sha1));
130 + return 0;
131 + }
132 + else
133 + return 1;
134 }