summaryrefslogtreecommitdiff
path: root/pack-bitmap-write.c
diff options
context:
space:
mode:
authorJeff King <peff@peff.net>2017-03-28 15:45:25 -0400
committerJunio C Hamano <gitster@pobox.com>2017-03-28 15:28:04 -0700
commit892e723afd2b5696e4d75280e730bf9f1ea92329 (patch)
tree072a0e33a4353dffa1e54bcdc58b9f80658cc2c1 /pack-bitmap-write.c
parente1104a5ee539408b81566066aaa6963cb87d5cd6 (diff)
downloadgit-892e723afd2b5696e4d75280e730bf9f1ea92329.tar.gz
do not check odb_mkstemp return value for errors
The odb_mkstemp function does not return an error; it dies on failure instead. But many of its callers compare the resulting descriptor against -1 and die themselves. Mostly this is just pointless, but it does raise a question when looking at the callers: if they show the results of the "template" buffer after a failure, what's in it? The answer is: it doesn't matter, because it cannot happen. So let's make that clear by removing the bogus error checks. In bitmap_writer_finish(), we can drop the error-handling code entirely. In the other two cases, it's shared with the open() in another code path; we can just move the error-check next to that open() call. And while we're at it, let's flesh out the function's docstring a bit to make the error behavior clear. Signed-off-by: Jeff King <peff@peff.net>
Diffstat (limited to 'pack-bitmap-write.c')
-rw-r--r--pack-bitmap-write.c2
1 files changed, 0 insertions, 2 deletions
diff --git a/pack-bitmap-write.c b/pack-bitmap-write.c
index 9705596014..44492c346c 100644
--- a/pack-bitmap-write.c
+++ b/pack-bitmap-write.c
@@ -517,8 +517,6 @@ void bitmap_writer_finish(struct pack_idx_entry **index,
int fd = odb_mkstemp(tmp_file, sizeof(tmp_file), "pack/tmp_bitmap_XXXXXX");
- if (fd < 0)
- die_errno("unable to create '%s'", tmp_file);
f = sha1fd(fd, tmp_file);
memcpy(header.magic, BITMAP_IDX_SIGNATURE, sizeof(BITMAP_IDX_SIGNATURE));