summaryrefslogtreecommitdiff
path: root/system/lvm2/fix-stdio-usage.patch
diff options
context:
space:
mode:
authorA. Wilcox <AWilcox@Wilcox-Tech.com>2023-10-02 00:07:17 -0500
committerA. Wilcox <AWilcox@Wilcox-Tech.com>2023-10-03 21:56:53 -0500
commitdcd477740a6483beb0aa5921fb11e7bac62b2615 (patch)
treec2760d9a2ab751c161cc0220d4a6ccb208a70767 /system/lvm2/fix-stdio-usage.patch
parentee71f0098a7782c4a95c2f1d7ee614569214be1c (diff)
downloadpackages-dcd477740a6483beb0aa5921fb11e7bac62b2615.tar.gz
packages-dcd477740a6483beb0aa5921fb11e7bac62b2615.tar.bz2
packages-dcd477740a6483beb0aa5921fb11e7bac62b2615.tar.xz
packages-dcd477740a6483beb0aa5921fb11e7bac62b2615.zip
system/lvm2: Update to 2.03.21
Patches stdio overrides that caused a segfault. Fixes: 2b7653a985 ("system/lvm2: bump { 2.03.13 --> 2.03.15 }.")
Diffstat (limited to 'system/lvm2/fix-stdio-usage.patch')
-rw-r--r--system/lvm2/fix-stdio-usage.patch35
1 files changed, 30 insertions, 5 deletions
diff --git a/system/lvm2/fix-stdio-usage.patch b/system/lvm2/fix-stdio-usage.patch
index 69832c004..2b3f0a91f 100644
--- a/system/lvm2/fix-stdio-usage.patch
+++ b/system/lvm2/fix-stdio-usage.patch
@@ -1,6 +1,28 @@
---- LVM2.2.03.08/tools/lvmcmdline.c 2020-02-11 03:59:27.000000000 -0600
-+++ LVM2.2.03.08/tools/lvmcmdline.c 2020-03-22 16:17:35.470100377 -0500
-@@ -3233,7 +3233,7 @@ static int _check_standard_fds(void)
+From 4cf08811e112100a2b10c60047f3c537ad21d674 Mon Sep 17 00:00:00 2001
+From: David Seifert <soap@gentoo.org>
+Date: Sat, 28 Jan 2023 14:22:42 +0100
+Subject: [PATCH] Use `freopen()` on {stdin,stdout,stderr}
+
+* ISO C does not guarantee that the standard streams are modifiable
+ lvalues. Glibc even calls out this behaviour as non-portable:
+ https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html
+--- a/lib/log/log.c
++++ b/lib/log/log.c
+@@ -208,7 +208,11 @@ int reopen_standard_stream(FILE **stream, const char *mode)
+
+ _check_and_replace_standard_log_streams(old_stream, new_stream);
+
++#ifdef __GLIBC__
+ *stream = new_stream;
++#else
++ freopen(NULL, mode, *stream);
++#endif
+ return 1;
+ }
+
+--- a/tools/lvmcmdline.c
++++ b/tools/lvmcmdline.c
+@@ -3422,7 +3422,7 @@ static int _check_standard_fds(void)
int err = is_valid_fd(STDERR_FILENO);
if (!is_valid_fd(STDIN_FILENO) &&
@@ -9,7 +31,7 @@
if (err)
perror("stdin stream open");
else
-@@ -3243,7 +3243,7 @@ static int _check_standard_fds(void)
+@@ -3432,7 +3432,7 @@ static int _check_standard_fds(void)
}
if (!is_valid_fd(STDOUT_FILENO) &&
@@ -18,7 +40,7 @@
if (err)
perror("stdout stream open");
/* else no stdout */
-@@ -3251,7 +3251,7 @@ static int _check_standard_fds(void)
+@@ -3440,7 +3440,7 @@ static int _check_standard_fds(void)
}
if (!is_valid_fd(STDERR_FILENO) &&
@@ -27,3 +49,6 @@
printf("stderr stream open: %s\n",
strerror(errno));
return 0;
+--
+2.39.2
+