Re: [PATCH] cons.saver: non-blocking console

2008-12-29 Thread Miguel de Icaza
Hello,

Opening the console in non-blocking mode is a bad idea, as it means
that every call that is done later on the console_fd needs to check for
EWOULDBLOCK.   Most of the time, it would be not return that, it would
only return that under unique situations which means that testing this
patch would not only be non-trivial, but someone would have to audit all
the code paths.

Also, this is lacking a ChangeLog explaining why this is needed.

But I think that this patch should not be applied, it seems like a
workaround that has not been properly implemented.

Miguel.

___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel


[PATCH] cons.saver: non-blocking console

2008-12-25 Thread Enrico Weigelt


-- 
-
 Enrico Weigelt==   metux IT service - http://www.metux.de/
-
 Please visit the OpenSource QM Taskforce:
http://wiki.metux.de/public/OpenSource_QM_Taskforce
 Patches / Fixes for a lot dozens of packages in dozens of versions:
http://patches.metux.de/
-
#
# cons.saver: open the console in non-blocking mode
#
# Source:   Gentoo Portage
# Reference:4.6.1
# Submit-By:Enrico Weigelt, metux IT service weig...@metux.de
# Submit-Date:  2008-12-26
# State:new
#
diff -ruN mc-4.6.1.orig/src/cons.saver.c mc-4.6.1/src/cons.saver.c
--- mc-4.6.1.orig/src/cons.saver.c  2008-12-26 02:19:54.0 +0100
+++ mc-4.6.1/src/cons.saver.c   2008-12-26 03:15:34.0 +0100
@@ -134,7 +134,7 @@
 
   if (seteuid (uid)  0)
 die ();
-  console_fd = open (tty_name, O_RDONLY);
+  console_fd = open (tty_name, O_RDONLY | O_NONBLOCK);
   if (console_fd  0)
 die ();
   if (fstat (console_fd, st)  0 || ! S_ISCHR (st.st_mode))
___
Mc-devel mailing list
http://mail.gnome.org/mailman/listinfo/mc-devel