summaryrefslogtreecommitdiff
path: root/builtin/index-pack.c
diff options
context:
space:
mode:
authorLibravatar René Scharfe <l.s.r@web.de>2021-09-10 22:25:50 +0200
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-09-10 14:22:50 -0700
commit6346f704a00a2fc94cc2ca26dbe872b446500bfd (patch)
treea3f475493afe4eed7318ceaa34737ddd18f1b0b4 /builtin/index-pack.c
parentuse xopen() to handle fatal open(2) failures (diff)
downloadtgif-6346f704a00a2fc94cc2ca26dbe872b446500bfd.tar.xz
index-pack: use xopen in init_thread
Support an arbitrary file descriptor expression in the semantic patch for replacing open+die_errno with xopen, not just an identifier, and apply it. This makes the error message at the single affected place more consistent and reduces code duplication. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/index-pack.c')
-rw-r--r--builtin/index-pack.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/builtin/index-pack.c b/builtin/index-pack.c
index 6cc4890217..738a35c53c 100644
--- a/builtin/index-pack.c
+++ b/builtin/index-pack.c
@@ -187,9 +187,7 @@ static void init_thread(void)
pthread_key_create(&key, NULL);
CALLOC_ARRAY(thread_data, nr_threads);
for (i = 0; i < nr_threads; i++) {
- thread_data[i].pack_fd = open(curr_pack, O_RDONLY);
- if (thread_data[i].pack_fd == -1)
- die_errno(_("unable to open %s"), curr_pack);
+ thread_data[i].pack_fd = xopen(curr_pack, O_RDONLY);
}
threads_active = 1;