From: Junio C Hamano Date: Sat, 25 Mar 2006 06:23:25 +0000 (-0800) Subject: commit-tree: check return value from write_sha1_file() X-Git-Tag: v1.3.0-rc1~1^2~6 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=7561d9f54412fcf443ebb28040bad67cd054a986;p=git.git commit-tree: check return value from write_sha1_file() ... found by Matthias Kestenholz. Signed-off-by: Junio C Hamano --- diff --git a/commit-tree.c b/commit-tree.c index 88871b022..16c178713 100644 --- a/commit-tree.c +++ b/commit-tree.c @@ -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; }