diff options
| author | Ophestra <cat@gensokyo.uk> | 2026-08-06 16:50:02 +0900 |
|---|---|---|
| committer | Ophestra <cat@gensokyo.uk> | 2026-08-06 16:50:02 +0900 |
| commit | 90535adc89a8af18427a9eb9d603a4c86eb7b540 (patch) | |
| tree | 28034e17d9d7487e4822614ea5b6d55037484e55 /internal/rosa/package/lvm2/fix-stdio-usage.patch | |
| parent | 6fed6d67bd112af1383977cba57bee6ffbf6610b (diff) | |
internal/rosa/package: lvm2
This is only really packaged for devmapper, and will eventually be replaced by a native implementation.
Signed-off-by: Ophestra <cat@gensokyo.uk>
Diffstat (limited to 'internal/rosa/package/lvm2/fix-stdio-usage.patch')
| -rw-r--r-- | internal/rosa/package/lvm2/fix-stdio-usage.patch | 67 |
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; |
