30 lines
870 B
Diff
30 lines
870 B
Diff
|
--- a/tools/lvmcmdline.c
|
||
|
+++ b/tools/lvmcmdline.c
|
||
|
@@ -3110,7 +3110,7 @@ static int _check_standard_fds(void)
|
||
|
int err = is_valid_fd(STDERR_FILENO);
|
||
|
|
||
|
if (!is_valid_fd(STDIN_FILENO) &&
|
||
|
- !(stdin = fopen(_PATH_DEVNULL, "r"))) {
|
||
|
+ !freopen(_PATH_DEVNULL, "r", stdin)) {
|
||
|
if (err)
|
||
|
perror("stdin stream open");
|
||
|
else
|
||
|
@@ -3120,7 +3120,7 @@ static int _check_standard_fds(void)
|
||
|
}
|
||
|
|
||
|
if (!is_valid_fd(STDOUT_FILENO) &&
|
||
|
- !(stdout = fopen(_PATH_DEVNULL, "w"))) {
|
||
|
+ !freopen(_PATH_DEVNULL, "r", stdout)) {
|
||
|
if (err)
|
||
|
perror("stdout stream open");
|
||
|
/* else no stdout */
|
||
|
@@ -3128,7 +3128,7 @@ static int _check_standard_fds(void)
|
||
|
}
|
||
|
|
||
|
if (!is_valid_fd(STDERR_FILENO) &&
|
||
|
- !(stderr = fopen(_PATH_DEVNULL, "w"))) {
|
||
|
+ !freopen(_PATH_DEVNULL, "w", stderr)) {
|
||
|
printf("stderr stream open: %s\n",
|
||
|
strerror(errno));
|
||
|
return 0;
|