]> git.ipfire.org Git - thirdparty/git.git/blobdiff - builtin/notes.c
use xopen() to handle fatal open(2) failures
[thirdparty/git.git] / builtin / notes.c
index 74bba39ca8293208d3d577a47e2617a11d856c20..71c59583a17f8da6eb948248e19a262781091f28 100644 (file)
@@ -172,9 +172,7 @@ static void prepare_note_data(const struct object_id *object, struct note_data *
 
                /* write the template message before editing: */
                d->edit_path = git_pathdup("NOTES_EDITMSG");
-               fd = open(d->edit_path, O_CREAT | O_TRUNC | O_WRONLY, 0600);
-               if (fd < 0)
-                       die_errno(_("could not create file '%s'"), d->edit_path);
+               fd = xopen(d->edit_path, O_CREAT | O_TRUNC | O_WRONLY, 0600);
 
                if (d->given)
                        write_or_die(fd, d->buf.buf, d->buf.len);