diff options
author | Junio C Hamano <gitster@pobox.com> | 2021-09-08 13:30:32 -0700 |
---|---|---|
committer | Junio C Hamano <gitster@pobox.com> | 2021-09-08 13:30:32 -0700 |
commit | 7b062226196c7234818106ab5274b32519e41575 (patch) | |
tree | af74b94d18186099a4a7929968a7691138058735 /builtin/add.c | |
parent | Merge branch 'dd/diff-files-unmerged-fix' (diff) | |
parent | use xopen() to handle fatal open(2) failures (diff) | |
download | tgif-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/add.c')
-rw-r--r-- | builtin/add.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/builtin/add.c b/builtin/add.c index 17528e8f92..8ec5ad9f26 100644 --- a/builtin/add.c +++ b/builtin/add.c @@ -319,9 +319,7 @@ static int edit_patch(int argc, const char **argv, const char *prefix) rev.diffopt.output_format = DIFF_FORMAT_PATCH; rev.diffopt.use_color = 0; rev.diffopt.flags.ignore_dirty_submodules = 1; - out = open(file, O_CREAT | O_WRONLY | O_TRUNC, 0666); - if (out < 0) - die(_("Could not open '%s' for writing."), file); + out = xopen(file, O_CREAT | O_WRONLY | O_TRUNC, 0666); rev.diffopt.file = xfdopen(out, "w"); rev.diffopt.close_file = 1; if (run_diff_files(&rev, 0)) |