Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.kernel.org/pub/scm/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-09-13 20:11:28 +0300
committerJunio C Hamano <gitster@pobox.com>2017-09-14 09:16:21 +0300
commit68a423ab3e5c160e1162382d2ef0831039b298d4 (patch)
tree85e6b35d1f5e3d27464ccba74ca9f12a99cc58be /builtin/get-tar-commit-id.c
parentefacf609c8f832be3e4ead634c054c8d52a00ad0 (diff)
get-tar-commit-id: check write_in_full() return against 0
We ask to write 41 bytes and make sure that the return value is at least 41. This is the same "dangerous" pattern that was fixed in the prior commit (wherein a negative return value is promoted to unsigned), though it is not dangerous here because our "41" is a constant, not an unsigned variable. But we should convert it anyway to avoid modeling a dangerous construct. Signed-off-by: Jeff King <peff@peff.net> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/get-tar-commit-id.c')
-rw-r--r--builtin/get-tar-commit-id.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/builtin/get-tar-commit-id.c b/builtin/get-tar-commit-id.c
index e21c5416cd..6d9a79f9b3 100644
--- a/builtin/get-tar-commit-id.c
+++ b/builtin/get-tar-commit-id.c
@@ -33,8 +33,7 @@ int cmd_get_tar_commit_id(int argc, const char **argv, const char *prefix)
if (!skip_prefix(content, "52 comment=", &comment))
return 1;
- n = write_in_full(1, comment, 41);
- if (n < 41)
+ if (write_in_full(1, comment, 41) < 0)
die_errno("git get-tar-commit-id: write error");
return 0;