mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-22 17:35:59 +03:00
Check for error from dup2
Do not take correct fd as error result.
This commit is contained in:
parent
a18693e705
commit
d61c67b52d
@ -67,9 +67,9 @@ static int _become_daemon(struct cmd_context *cmd)
|
||||
_exit(ECMD_FAILED);
|
||||
}
|
||||
|
||||
if (dup2(null_fd, STDIN_FILENO) || /* reopen stdin */
|
||||
dup2(null_fd, STDOUT_FILENO) || /* reopen stdout */
|
||||
dup2(null_fd, STDERR_FILENO)) { /* reopen stderr */
|
||||
if ((dup2(null_fd, STDIN_FILENO) < 0) || /* reopen stdin */
|
||||
(dup2(null_fd, STDOUT_FILENO) < 0) || /* reopen stdout */
|
||||
(dup2(null_fd, STDERR_FILENO) < 0)) { /* reopen stderr */
|
||||
log_sys_error("dup2", "redirect");
|
||||
(void) close(null_fd);
|
||||
_exit(ECMD_FAILED);
|
||||
|
Loading…
Reference in New Issue
Block a user