Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/git/git.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRené Scharfe <l.s.r@web.de>2021-08-25 23:16:46 +0300
committerJunio C Hamano <gitster@pobox.com>2021-08-26 00:39:08 +0300
commit66e905b7dd0f4e9dd576be681f30fbaeeb19ec4a (patch)
tree4cff22e9d61be87fc5bce6952981e8ba1c7b7127 /builtin/mailsplit.c
parenta7439d0f9dd291e7cc9e6c2dda19cbfdf09b62ee (diff)
use xopen() to handle fatal open(2) failures
Add and apply a semantic patch for using xopen() instead of calling open(2) and die() or die_errno() explicitly. This makes the error messages more consistent and shortens the code. Signed-off-by: René Scharfe <l.s.r@web.de> Signed-off-by: Junio C Hamano <gitster@pobox.com>
Diffstat (limited to 'builtin/mailsplit.c')
-rw-r--r--builtin/mailsplit.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/builtin/mailsplit.c b/builtin/mailsplit.c
index 664400b8169..7baef30569f 100644
--- a/builtin/mailsplit.c
+++ b/builtin/mailsplit.c
@@ -75,9 +75,7 @@ static int split_one(FILE *mbox, const char *name, int allow_bare)
fprintf(stderr, "corrupt mailbox\n");
exit(1);
}
- fd = open(name, O_WRONLY | O_CREAT | O_EXCL, 0666);
- if (fd < 0)
- die_errno("cannot open output file '%s'", name);
+ fd = xopen(name, O_WRONLY | O_CREAT | O_EXCL, 0666);
output = xfdopen(fd, "w");
/* Copy it out, while searching for a line that begins with