summaryrefslogtreecommitdiff
path: root/builtin/tag.c
diff options
context:
space:
mode:
authorLibravatar Junio C Hamano <gitster@pobox.com>2021-09-08 13:30:32 -0700
committerLibravatar Junio C Hamano <gitster@pobox.com>2021-09-08 13:30:32 -0700
commit7b062226196c7234818106ab5274b32519e41575 (patch)
treeaf74b94d18186099a4a7929968a7691138058735 /builtin/tag.c
parentMerge branch 'dd/diff-files-unmerged-fix' (diff)
parentuse xopen() to handle fatal open(2) failures (diff)
downloadtgif-7b062226196c7234818106ab5274b32519e41575.tar.xz
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/tag.c')
-rw-r--r--builtin/tag.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/builtin/tag.c b/builtin/tag.c
index 452558ec95..065b6bf093 100644
--- a/builtin/tag.c
+++ b/builtin/tag.c
@@ -293,9 +293,7 @@ static void create_tag(const struct object_id *object, const char *object_ref,
/* write the template message before editing: */
path = git_pathdup("TAG_EDITMSG");
- fd = open(path, O_CREAT | O_TRUNC | O_WRONLY, 0600);
- if (fd < 0)
- die_errno(_("could not create file '%s'"), path);
+ fd = xopen(path, O_CREAT | O_TRUNC | O_WRONLY, 0600);
if (opt->message_given) {
write_or_die(fd, buf->buf, buf->len);