commit-tree: check return value from write_sha1_file()
... found by Matthias Kestenholz. Signed-off-by: Junio C Hamano <junkio@cox.net>
This commit is contained in:
parent
79f558a5fc
commit
7561d9f544
@ -125,7 +125,10 @@ int main(int argc, char **argv)
|
||||
while (fgets(comment, sizeof(comment), stdin) != NULL)
|
||||
add_buffer(&buffer, &size, "%s", comment);
|
||||
|
||||
write_sha1_file(buffer, size, "commit", commit_sha1);
|
||||
printf("%s\n", sha1_to_hex(commit_sha1));
|
||||
return 0;
|
||||
if (!write_sha1_file(buffer, size, "commit", commit_sha1)) {
|
||||
printf("%s\n", sha1_to_hex(commit_sha1));
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user