file upgraded to version 5.36
[dragora.git] / patches / lvm2 / fix-stdio-usage.patch
blob39ba2e1b4e0a85d514749c89efbc7abee918cc17
1 --- ./tools/lvmcmdline.c
2 +++ ./tools/lvmcmdline.c
3 @@ -1252,7 +1252,7 @@
4 int err = is_valid_fd(STDERR_FILENO);
6 if (!is_valid_fd(STDIN_FILENO) &&
7 - !(stdin = fopen(_PATH_DEVNULL, "r"))) {
8 + !freopen(_PATH_DEVNULL, "r", stdin)) {
9 if (err)
10 perror("stdin stream open");
11 else
12 @@ -1262,7 +1262,7 @@
15 if (!is_valid_fd(STDOUT_FILENO) &&
16 - !(stdout = fopen(_PATH_DEVNULL, "w"))) {
17 + !freopen(_PATH_DEVNULL, "w", stdout)) {
18 if (err)
19 perror("stdout stream open");
20 /* else no stdout */
21 @@ -1270,7 +1270,7 @@
24 if (!is_valid_fd(STDERR_FILENO) &&
25 - !(stderr = fopen(_PATH_DEVNULL, "w"))) {
26 + !freopen(_PATH_DEVNULL, "w", stderr)) {
27 printf("stderr stream open: %s\n",
28 strerror(errno));
29 return 0;
30 --- ./lib/commands/toolcontext.c.orig
31 +++ ./lib/commands/toolcontext.c
32 @@ -1860,7 +1860,7 @@
33 /* FIXME Make this configurable? */
34 reset_lvm_errno(1);
36 -#ifndef VALGRIND_POOL
37 +#if !defined(VALGRIND_POOL) && defined(__GLIBC__)
38 /* Set in/out stream buffering before glibc */
39 if (set_buffering) {
40 /* Allocate 2 buffers */
41 @@ -2241,7 +2241,7 @@
42 if (cmd->libmem)
43 dm_pool_destroy(cmd->libmem);
45 -#ifndef VALGRIND_POOL
46 +#if !defined(VALGRIND_POOL) && defined(__GLIBC__)
47 if (cmd->linebuffer) {
48 /* Reset stream buffering to defaults */
49 if (is_valid_fd(STDIN_FILENO) &&