diff --git a/x11-packages/bochs/gui-term.cc.patch b/x11-packages/bochs/gui-term.cc.patch index e6217de0c..0507ffa93 100644 --- a/x11-packages/bochs/gui-term.cc.patch +++ b/x11-packages/bochs/gui-term.cc.patch @@ -1,5 +1,5 @@ --- bochs-2.6.9/gui/term.cc 2017-01-15 19:44:43.000000000 +0800 -+++ bochs-2.6.9.mod/gui/term.cc 2019-08-26 00:46:12.453482400 +0800 ++++ bochs-2.6.9.mod/gui/term.cc 2019-08-26 01:29:09.440407700 +0800 @@ -33,7 +33,11 @@ #include }; @@ -13,3 +13,34 @@ class bx_term_gui_c : public bx_gui_c { public: +@@ -180,20 +184,25 @@ + if (!strcmp(SIM->get_param_string(BXPN_LOG_FILENAME)->getptr(), "-")) + BX_PANIC(("cannot log to stderr in term mode")); + #else +- FILE *old_stdin = stdin; +- FILE *old_stdout = stdout; ++ int old_stdin = dup(STDIN_FILENO); ++ int old_stdout = dup(STDOUT_FILENO); + scr_fd = open("/dev/ptmx",O_RDWR); + if(scr_fd > 0){ +- stdin = stdout = fdopen(scr_fd,"wr"); + grantpt(scr_fd); + unlockpt(scr_fd); ++ FILE * pty = fdopen(scr_fd,"wr"); ++ int pts = fileno(pty); ++ dup2(pts,STDIN_FILENO); ++ dup2(pts,STDOUT_FILENO); + fprintf(stderr, "\nBochs connected to screen \"%s\"\n",ptsname(scr_fd)); + } + #endif + initscr(); + #if BX_DEBUGGER_TERM +- stdin = old_stdin; +- stdout = old_stdout; ++ dup2(old_stdin,STDIN_FILENO); ++ dup2(old_stdout,STDOUT_FILENO); ++ close(old_stdin); ++ close(old_stdout); + #endif + start_color(); + cbreak();