Christian Wiese
11 years ago
1 changed files with 121 additions and 0 deletions
@ -0,0 +1,121 @@ |
|||||||
|
# --- SDE-COPYRIGHT-NOTE-BEGIN ---
|
||||||
|
# This copyright note is auto-generated by ./scripts/Create-CopyPatch.
|
||||||
|
#
|
||||||
|
# Filename: package/.../musl/pkg/lvm2/lvm2-musl-0001-read-only-assignment.patch
|
||||||
|
# Copyright (C) 2012 - 2013 The OpenSDE Project
|
||||||
|
#
|
||||||
|
# More information can be found in the files COPYING and README.
|
||||||
|
#
|
||||||
|
# This patch file is dual-licensed. It is available under the license the
|
||||||
|
# patched project is licensed under, as long as it is an OpenSource license
|
||||||
|
# as defined at http://www.opensource.org/ (e.g. BSD, X11) or under the terms
|
||||||
|
# of the GNU General Public License as published by the Free Software
|
||||||
|
# Foundation; either version 2 of the License, or (at your option) any later
|
||||||
|
# version.
|
||||||
|
# --- SDE-COPYRIGHT-NOTE-END ---
|
||||||
|
|
||||||
|
--- a/tools/lvmcmdline.c 2012-11-24 19:32:51.319288478 +0100
|
||||||
|
+++ b/tools/lvmcmdline.c 2012-11-24 19:34:46.381960596 +0100
|
||||||
|
@@ -1194,9 +1194,12 @@
|
||||||
|
static int _check_standard_fds(void)
|
||||||
|
{
|
||||||
|
int err = is_valid_fd(STDERR_FILENO);
|
||||||
|
+ FILE *stdin_stream = stdin;
|
||||||
|
+ FILE *stdout_stream = stdout;
|
||||||
|
+ FILE *stderr_stream = stderr;
|
||||||
|
|
||||||
|
if (!is_valid_fd(STDIN_FILENO) &&
|
||||||
|
- !(stdin = fopen(_PATH_DEVNULL, "r"))) {
|
||||||
|
+ !(stdin_stream = fopen(_PATH_DEVNULL, "r"))) {
|
||||||
|
if (err)
|
||||||
|
perror("stdin stream open");
|
||||||
|
else
|
||||||
|
@@ -1206,7 +1209,7 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_valid_fd(STDOUT_FILENO) &&
|
||||||
|
- !(stdout = fopen(_PATH_DEVNULL, "w"))) {
|
||||||
|
+ !(stdout_stream = fopen(_PATH_DEVNULL, "w"))) {
|
||||||
|
if (err)
|
||||||
|
perror("stdout stream open");
|
||||||
|
/* else no stdout */
|
||||||
|
@@ -1214,7 +1217,7 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!is_valid_fd(STDERR_FILENO) &&
|
||||||
|
- !(stderr = fopen(_PATH_DEVNULL, "w"))) {
|
||||||
|
+ !(stderr_stream = fopen(_PATH_DEVNULL, "w"))) {
|
||||||
|
printf("stderr stream open: %s\n",
|
||||||
|
strerror(errno));
|
||||||
|
return 0;
|
||||||
|
--- a/lib/commands/toolcontext.c 2012-11-24 19:16:13.532208503 +0100
|
||||||
|
+++ b/lib/commands/toolcontext.c 2012-11-24 19:45:44.053159552 +0100
|
||||||
|
@@ -1315,6 +1315,8 @@
|
||||||
|
{
|
||||||
|
struct cmd_context *cmd;
|
||||||
|
FILE *new_stream;
|
||||||
|
+ FILE *stdin_stream = stdin;
|
||||||
|
+ FILE *stdout_stream = stdout;
|
||||||
|
|
||||||
|
#ifdef M_MMAP_MAX
|
||||||
|
mallopt(M_MMAP_MAX, 0);
|
||||||
|
@@ -1359,20 +1361,20 @@
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_valid_fd(STDIN_FILENO)) {
|
||||||
|
- if (!_reopen_stream(stdin, STDIN_FILENO, "r", "stdin", &new_stream))
|
||||||
|
+ if (!_reopen_stream(stdin_stream, STDIN_FILENO, "r", "stdin", &new_stream))
|
||||||
|
goto_out;
|
||||||
|
- stdin = new_stream;
|
||||||
|
- if (setvbuf(stdin, cmd->linebuffer, _IOLBF, linebuffer_size)) {
|
||||||
|
+ stdin_stream = new_stream;
|
||||||
|
+ if (setvbuf(stdin_stream, cmd->linebuffer, _IOLBF, linebuffer_size)) {
|
||||||
|
log_sys_error("setvbuf", "");
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_valid_fd(STDOUT_FILENO)) {
|
||||||
|
- if (!_reopen_stream(stdout, STDOUT_FILENO, "w", "stdout", &new_stream))
|
||||||
|
+ if (!_reopen_stream(stdout_stream, STDOUT_FILENO, "w", "stdout", &new_stream))
|
||||||
|
goto_out;
|
||||||
|
- stdout = new_stream;
|
||||||
|
- if (setvbuf(stdout, cmd->linebuffer + linebuffer_size,
|
||||||
|
+ stdout_stream = new_stream;
|
||||||
|
+ if (setvbuf(stdout_stream, cmd->linebuffer + linebuffer_size,
|
||||||
|
_IOLBF, linebuffer_size)) {
|
||||||
|
log_sys_error("setvbuf", "");
|
||||||
|
goto out;
|
||||||
|
@@ -1629,6 +1631,8 @@
|
||||||
|
{
|
||||||
|
struct dm_config_tree *cft_cmdline;
|
||||||
|
FILE *new_stream;
|
||||||
|
+ FILE *stdin_stream = stdin;
|
||||||
|
+ FILE *stdout_stream = stdout;
|
||||||
|
|
||||||
|
if (cmd->dump_filter)
|
||||||
|
persistent_filter_dump(cmd->filter, 1);
|
||||||
|
@@ -1655,17 +1659,17 @@
|
||||||
|
if (cmd->linebuffer) {
|
||||||
|
/* Reset stream buffering to defaults */
|
||||||
|
if (is_valid_fd(STDIN_FILENO)) {
|
||||||
|
- if (_reopen_stream(stdin, STDIN_FILENO, "r", "stdin", &new_stream)) {
|
||||||
|
- stdin = new_stream;
|
||||||
|
- setlinebuf(stdin);
|
||||||
|
+ if (_reopen_stream(stdin_stream, STDIN_FILENO, "r", "stdin", &new_stream)) {
|
||||||
|
+ stdin_stream = new_stream;
|
||||||
|
+ setlinebuf(stdin_stream);
|
||||||
|
} else
|
||||||
|
cmd->linebuffer = NULL; /* Leave buffer in place (deliberate leak) */
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_valid_fd(STDOUT_FILENO)) {
|
||||||
|
- if (_reopen_stream(stdout, STDOUT_FILENO, "w", "stdout", &new_stream)) {
|
||||||
|
- stdout = new_stream;
|
||||||
|
- setlinebuf(stdout);
|
||||||
|
+ if (_reopen_stream(stdout_stream, STDOUT_FILENO, "w", "stdout", &new_stream)) {
|
||||||
|
+ stdout_stream = new_stream;
|
||||||
|
+ setlinebuf(stdout_stream);
|
||||||
|
} else
|
||||||
|
cmd->linebuffer = NULL; /* Leave buffer in place (deliberate leak) */
|
||||||
|
}
|
Loading…
Reference in new issue