forked from osmocom/wireshark
win32: fix MR180 - broke "-i -" input pipe
This commit is contained in:
parent
cda11f813d
commit
44241f694e
|
@ -210,6 +210,8 @@ restore_pipes(void)
|
||||||
gboolean must_redirect_stdout;
|
gboolean must_redirect_stdout;
|
||||||
gboolean must_redirect_stderr;
|
gboolean must_redirect_stderr;
|
||||||
|
|
||||||
|
HANDLE fd;
|
||||||
|
|
||||||
if (stdin_capture) {
|
if (stdin_capture) {
|
||||||
/* We've been handed "-i -". Don't mess with stdio. */
|
/* We've been handed "-i -". Don't mess with stdio. */
|
||||||
return;
|
return;
|
||||||
|
@ -228,6 +230,9 @@ restore_pipes(void)
|
||||||
if (!must_redirect_stdin && !must_redirect_stdout && !must_redirect_stderr)
|
if (!must_redirect_stdin && !must_redirect_stdout && !must_redirect_stderr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
if (!must_redirect_stdin)
|
||||||
|
fd = GetStdHandle(STD_INPUT_HANDLE);
|
||||||
|
|
||||||
/* OK, at least one of them needs to be redirected to a console;
|
/* OK, at least one of them needs to be redirected to a console;
|
||||||
try to attach to the parent process's console and, if that fails,
|
try to attach to the parent process's console and, if that fails,
|
||||||
cleanup and return. */
|
cleanup and return. */
|
||||||
|
@ -240,8 +245,11 @@ restore_pipes(void)
|
||||||
return; /* No parent - cleanup and exit */
|
return; /* No parent - cleanup and exit */
|
||||||
}
|
}
|
||||||
|
|
||||||
if (must_redirect_stdin)
|
if (must_redirect_stdin) {
|
||||||
ws_freopen("CONIN$", "r", stdin);
|
ws_freopen("CONIN$", "r", stdin);
|
||||||
|
} else {
|
||||||
|
SetStdHandle(STD_INPUT_HANDLE, fd);
|
||||||
|
}
|
||||||
if (must_redirect_stdout) {
|
if (must_redirect_stdout) {
|
||||||
ws_freopen("CONOUT$", "w", stdout);
|
ws_freopen("CONOUT$", "w", stdout);
|
||||||
fprintf(stdout, "\n");
|
fprintf(stdout, "\n");
|
||||||
|
|
Loading…
Reference in New Issue