[Mono-bugs] [Bug 81729][Nor] Changed - [PATCH] Console.Read(Line) doesn't block for winexes
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Fri Aug 17 11:34:52 EDT 2007
Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.
Changed by miguel at ximian.com.
http://bugzilla.ximian.com/show_bug.cgi?id=81729
--- shadow/81729 2007-05-25 16:23:22.000000000 -0400
+++ shadow/81729.tmp.24030 2007-08-17 11:34:52.000000000 -0400
@@ -94,6 +94,19 @@
Dick, are you okay with these patches?
The optimal fix would be to implement this in WAPI's GetStdHandle,
but WAPI doesn't have access to the PE header. Hence I decided
to close STDIN and handle this locally in Console.cs.
+
+------- Additional Comments From miguel at ximian.com 2007-08-17 11:34 -------
+Closing stdin is not a good idea because libraries assume that the
+file descriptor will be valid and will be stdin.
+
+The problem is that you close that, someone else opens a file which
+happens to get the descriptor for stdin, and then some library tries
+to read and happens to advance the pointer of a file that you do not own.
+
+If we close stdin, we probably should open /dev/null and do a dup2 to
+the stdin descriptor.
+
+
More information about the mono-bugs
mailing list