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>
This commit is contained in:

committed by
Junio C Hamano

parent
a7439d0f9d
commit
66e905b7dd
@ -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);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user