aboutsummaryrefslogtreecommitdiffstats
path: root/builtin/commit-tree.c
diff options
context:
space:
mode:
authorJunio C Hamano <gitster@pobox.com>2021-09-08 13:30:32 -0700
committerJunio C Hamano <gitster@pobox.com>2021-09-08 13:30:32 -0700
commit7b062226196c7234818106ab5274b32519e41575 (patch)
treeaf74b94d18186099a4a7929968a7691138058735 /builtin/commit-tree.c
parentMerge branch 'dd/diff-files-unmerged-fix' (diff)
parentuse xopen() to handle fatal open(2) failures (diff)
downloadgit-7b062226196c7234818106ab5274b32519e41575.tar.gz
git-7b062226196c7234818106ab5274b32519e41575.zip
Merge branch 'rs/xopen-reports-open-failures'
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/commit-tree.c')
-rw-r--r--builtin/commit-tree.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/builtin/commit-tree.c b/builtin/commit-tree.c
index 1031b9a491..63ea322933 100644
--- a/builtin/commit-tree.c
+++ b/builtin/commit-tree.c
@@ -88,9 +88,7 @@ static int parse_file_arg_callback(const struct option *opt,
if (!strcmp(arg, "-"))
fd = 0;
else {
- fd = open(arg, O_RDONLY);
- if (fd < 0)
- die_errno(_("git commit-tree: failed to open '%s'"), arg);
+ fd = xopen(arg, O_RDONLY);
}
if (strbuf_read(buf, fd, 0) < 0)
die_errno(_("git commit-tree: failed to read '%s'"), arg);