aboutsummaryrefslogtreecommitdiffhomepage
path: root/internal/rosa/package/lvm2/fix-stdio-usage.patch
diff options
context:
space:
mode:
Diffstat (limited to 'internal/rosa/package/lvm2/fix-stdio-usage.patch')
-rw-r--r--internal/rosa/package/lvm2/fix-stdio-usage.patch67
1 files changed, 67 insertions, 0 deletions
diff --git a/internal/rosa/package/lvm2/fix-stdio-usage.patch b/internal/rosa/package/lvm2/fix-stdio-usage.patch
new file mode 100644
index 00000000..103618c4
--- /dev/null
+++ b/internal/rosa/package/lvm2/fix-stdio-usage.patch
@@ -0,0 +1,67 @@
+diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
+index 60739af..8b3fdf7 100644
+--- a/lib/commands/toolcontext.c
++++ b/lib/commands/toolcontext.c
+@@ -1661,6 +1661,7 @@ struct cmd_context *create_toolcontext(unsigned is_clvmd,
+ reset_lvm_errno(1);
+
+ /* Set in/out stream buffering before glibc */
++#ifdef __GLIBC__
+ if (set_buffering
+ && !cmd->running_on_valgrind /* Skipping within valgrind execution. */
+ #ifdef SYS_gettid
+@@ -1704,6 +1705,7 @@ struct cmd_context *create_toolcontext(unsigned is_clvmd,
+ } else if (!set_buffering)
+ /* Without buffering, must not use stdin/stdout */
+ init_silent(1);
++#endif
+
+ /*
+ * Environment variable LVM_SYSTEM_DIR overrides this below.
+@@ -2038,6 +2040,7 @@ void destroy_toolcontext(struct cmd_context *cmd)
+ if (cmd->cft_def_hash)
+ dm_hash_destroy(cmd->cft_def_hash);
+
++#ifdef __GLIBC__
+ if (!cmd->running_on_valgrind && cmd->linebuffer) {
+ int flags;
+ /* Reset stream buffering to defaults */
+@@ -2061,6 +2064,7 @@ void destroy_toolcontext(struct cmd_context *cmd)
+
+ free(cmd->linebuffer);
+ }
++#endif
+
+ destroy_config_context(cmd);
+
+diff --git a/tools/lvmcmdline.c b/tools/lvmcmdline.c
+index 7209ebd..778c8c0 100644
+--- a/tools/lvmcmdline.c
++++ b/tools/lvmcmdline.c
+@@ -3378,7 +3378,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
+@@ -3388,7 +3388,7 @@ static int _check_standard_fds(void)
+ }
+
+ if (!is_valid_fd(STDOUT_FILENO) &&
+- !(stdout = fopen(_PATH_DEVNULL, "w"))) {
++ !freopen(_PATH_DEVNULL, "w", stdout)) {
+ if (err)
+ perror("stdout stream open");
+ /* else no stdout */
+@@ -3396,7 +3396,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;