|
@@ -0,0 +1,58 @@
|
|
1
|
+Index: LVM2.2.02.118/lib/commands/toolcontext.c
|
|
2
|
+===================================================================
|
|
3
|
+--- LVM2.2.02.118.orig/lib/commands/toolcontext.c
|
|
4
|
++++ LVM2.2.02.118/lib/commands/toolcontext.c
|
|
5
|
+@@ -1625,8 +1625,10 @@ struct cmd_context *create_toolcontext(u
|
|
6
|
+ unsigned threaded)
|
|
7
|
+ {
|
|
8
|
+ struct cmd_context *cmd;
|
|
9
|
++#if defined(__GLIBC__) && !defined(VALGRIND_POOL)
|
|
10
|
+ FILE *new_stream;
|
|
11
|
+ int flags;
|
|
12
|
++#endif
|
|
13
|
+
|
|
14
|
+ #ifdef M_MMAP_MAX
|
|
15
|
+ mallopt(M_MMAP_MAX, 0);
|
|
16
|
+@@ -1662,7 +1664,7 @@ struct cmd_context *create_toolcontext(u
|
|
17
|
+ /* FIXME Make this configurable? */
|
|
18
|
+ reset_lvm_errno(1);
|
|
19
|
+
|
|
20
|
+-#ifndef VALGRIND_POOL
|
|
21
|
++#if defined(__GLIBC__) && !defined(VALGRIND_POOL)
|
|
22
|
+ /* Set in/out stream buffering before glibc */
|
|
23
|
+ if (set_buffering) {
|
|
24
|
+ /* Allocate 2 buffers */
|
|
25
|
+@@ -2035,7 +2037,7 @@ void destroy_toolcontext(struct cmd_cont
|
|
26
|
+ if (cmd->libmem)
|
|
27
|
+ dm_pool_destroy(cmd->libmem);
|
|
28
|
+
|
|
29
|
+-#ifndef VALGRIND_POOL
|
|
30
|
++#if defined(__GLIBC__) && !defined(VALGRIND_POOL)
|
|
31
|
+ if (cmd->linebuffer) {
|
|
32
|
+ /* Reset stream buffering to defaults */
|
|
33
|
+ if (is_valid_fd(STDIN_FILENO) &&
|
|
34
|
+Index: LVM2.2.02.118/tools/lvmcmdline.c
|
|
35
|
+===================================================================
|
|
36
|
+--- LVM2.2.02.118.orig/tools/lvmcmdline.c
|
|
37
|
++++ LVM2.2.02.118/tools/lvmcmdline.c
|
|
38
|
+@@ -1602,6 +1602,7 @@ int lvm_split(char *str, int *argc, char
|
|
39
|
+ /* Make sure we have always valid filedescriptors 0,1,2 */
|
|
40
|
+ static int _check_standard_fds(void)
|
|
41
|
+ {
|
|
42
|
++#ifdef __GLIBC__
|
|
43
|
+ int err = is_valid_fd(STDERR_FILENO);
|
|
44
|
+
|
|
45
|
+ if (!is_valid_fd(STDIN_FILENO) &&
|
|
46
|
+@@ -1628,6 +1629,12 @@ static int _check_standard_fds(void)
|
|
47
|
+ strerror(errno));
|
|
48
|
+ return 0;
|
|
49
|
+ }
|
|
50
|
++#else
|
|
51
|
++ if (!is_valid_fd(STDERR_FILENO) ||
|
|
52
|
++ !is_valid_fd(STDOUT_FILENO) ||
|
|
53
|
++ !is_valid_fd(STDIN_FILENO))
|
|
54
|
++ return 0;
|
|
55
|
++#endif
|
|
56
|
+
|
|
57
|
+ return 1;
|
|
58
|
+ }
|