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

git.kernel.org/pub/scm/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 /run-command.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 'run-command.c')
-rw-r--r--run-command.c4
1 files changed, 1 insertions, 3 deletions
diff --git a/run-command.c b/run-command.c
index f72e72cce7..2961f7e55e 100644
--- a/run-command.c
+++ b/run-command.c
@@ -761,9 +761,7 @@ fail_pipe:
notify_pipe[0] = notify_pipe[1] = -1;
if (cmd->no_stdin || cmd->no_stdout || cmd->no_stderr) {
- null_fd = open("/dev/null", O_RDWR | O_CLOEXEC);
- if (null_fd < 0)
- die_errno(_("open /dev/null failed"));
+ null_fd = xopen("/dev/null", O_RDWR | O_CLOEXEC);
set_cloexec(null_fd);
}