summaryrefslogtreecommitdiff
path: root/builtin/update-index.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-10-12 13:51:28 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-10-12 13:51:28 -0700
commit1c23cc1344423a4fe519ba8ffab81a68db4f51f4 (patch)
tree7e2eb379cbf77b998e50fedec1278540b1228a05 /builtin/update-index.c
parentMerge branch 'dd/t6300-wo-gpg-fix' into maint (diff)
parentuse xopen() to handle fatal open(2) failures (diff)
downloadtgif-1c23cc1344423a4fe519ba8ffab81a68db4f51f4.tar.xz
Merge branch 'rs/xopen-reports-open-failures' into maint
Error diagnostics improvement. * rs/xopen-reports-open-failures: use xopen() to handle fatal open(2) failures xopen: explicitly report creation failures
Diffstat (limited to 'builtin/update-index.c')
-rw-r--r--builtin/update-index.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/builtin/update-index.c b/builtin/update-index.c
index f1f16f2de5..187203e8bb 100644
--- a/builtin/update-index.c
+++ b/builtin/update-index.c
@@ -95,9 +95,7 @@ static int create_file(const char *path)
{
int fd;
path = get_mtime_path(path);
- fd = open(path, O_CREAT | O_RDWR, 0644);
- if (fd < 0)
- die_errno(_("failed to create file %s"), path);
+ fd = xopen(path, O_CREAT | O_RDWR, 0644);
return fd;
}