kumquat-buildroot/package/lvm2/0002-log-use-freopen-to-reopen-standard-streams.patch
Julien Olivain 4cbac9f706 package/lvm2: bump to version 2.03.23
For release notes since 2.03.14, see:
22e482d965/WHATS_NEW (L4)

This commit removes the package patches 1 and 2 which are now included
in the new release. Patches 3 and 4 are kept and renumbered.

Signed-off-by: Julien Olivain <ju.o@free.fr>
Signed-off-by: Arnout Vandecappelle <arnout@mind.be>
2024-04-02 21:54:30 +02:00

45 lines
1.2 KiB
Diff

From 6d6b953cf7d2b8d06e7b0363b1b06cb2e902aa0f Mon Sep 17 00:00:00 2001
From: Simon Rowe <simon.rowe@nutanix.com>
Date: Thu, 23 Mar 2023 10:07:02 +0000
Subject: [PATCH] log: use freopen() to reopen standard streams
In glibc stdin, stdout & stderr are variables that can be assigned to
(https://www.gnu.org/software/libc/manual/html_node/Standard-Streams.html)
however this not necessarily true of other C libraries.
The gentoo musl porting notes
(https://wiki.gentoo.org/wiki/Musl_porting_notes)
recommend the substitution of
stdX = fopen(...)
with
freopen(..., stdX)
Taken from: https://github.com/gentoo/gentoo/blob/master/sys-fs/lvm2/files/lvm2-2.03.14-freopen_n2.patch
Signed-off-by: Simon Rowe <simon.rowe@nutanix.com>
---
lib/log/log.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/log/log.c b/lib/log/log.c
index 7b4d537b3..5f62c048c 100644
--- 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;
}
--
2.22.3