mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
Hurd bug 22861: Do not select() exceptions from pipes.
The GNU Hurd has a bug that can make select() report an exception in a pipe even though none has actually occurred. The typical result is that ELinks closes the pipe through which it internally passes all input events, such as keypresses. It then no longer reacts to what the user is trying to do. Work around the Hurd bug by making set_handlers() check whether the file descriptor refers to a pipe, and if so, pretend the caller did not provide any handler for exceptions. This is a minimal change that avoids slowing down the select() loop itself and does not require careful analysis of the callers to statically find out which file descriptors might refer to pipes. The extra stat() calls may slow ELinks down somewhat, but anyway it'll work better than it did without the patch, and if the Hurd bug is ever fixed, we can remove the workaround at that time.
This commit is contained in:
parent
b94657869b
commit
a0d624cd61
2
NEWS
2
NEWS
@ -30,6 +30,8 @@ includes the changes listed under "ELinks 0.11.4.GIT now" below.
|
|||||||
SSL errors especially in HTTP POST requests using GnuTLS.
|
SSL errors especially in HTTP POST requests using GnuTLS.
|
||||||
* bugs 1007, 1041: Display unrecognized lines in FTP directory
|
* bugs 1007, 1041: Display unrecognized lines in FTP directory
|
||||||
listings, instead of annoying the user with error messages.
|
listings, instead of annoying the user with error messages.
|
||||||
|
* Hurd bug 22861: Work around select() falsely reporting exceptions
|
||||||
|
in pipes.
|
||||||
* minor bug 951: SpiderMonkey scripting objects used to prevent ELinks
|
* minor bug 951: SpiderMonkey scripting objects used to prevent ELinks
|
||||||
from removing files from the memory cache.
|
from removing files from the memory cache.
|
||||||
* build bug 1044: Check whether -rdynamic works with libraries.
|
* build bug 1044: Check whether -rdynamic works with libraries.
|
||||||
|
@ -10,6 +10,9 @@
|
|||||||
#ifdef HAVE_SYS_SIGNAL_H
|
#ifdef HAVE_SYS_SIGNAL_H
|
||||||
#include <sys/signal.h>
|
#include <sys/signal.h>
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __GNU__ /* For GNU Hurd bug workaround in set_handlers() */
|
||||||
|
#include <sys/stat.h> /* OS/2 needs this after sys/types.h */
|
||||||
|
#endif
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
#ifdef HAVE_SYS_WAIT_H
|
#ifdef HAVE_SYS_WAIT_H
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h>
|
||||||
@ -146,6 +149,21 @@ set_handlers(int fd, select_handler_T read_func, select_handler_T write_func,
|
|||||||
fd, FD_SETSIZE);
|
fd, FD_SETSIZE);
|
||||||
if_assert_failed return;
|
if_assert_failed return;
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef __GNU__
|
||||||
|
/* GNU Hurd pflocal bug <http://savannah.gnu.org/bugs/?22861>:
|
||||||
|
* If ELinks does a select() where the initial exceptfds set
|
||||||
|
* includes a pipe that is not listed in the other fd_sets,
|
||||||
|
* then select() always reports an exception there. That
|
||||||
|
* makes Elinks think the pipe has failed and close it.
|
||||||
|
* To work around this bug, do not monitor exceptions for
|
||||||
|
* pipes on the Hurd. */
|
||||||
|
if (error_func) {
|
||||||
|
struct stat st;
|
||||||
|
|
||||||
|
if (fstat(fd, &st) == 0 && S_ISFIFO(st.st_mode))
|
||||||
|
error_func = NULL;
|
||||||
|
}
|
||||||
|
#endif /* __GNU__ */
|
||||||
threads[fd].read_func = read_func;
|
threads[fd].read_func = read_func;
|
||||||
threads[fd].write_func = write_func;
|
threads[fd].write_func = write_func;
|
||||||
threads[fd].error_func = error_func;
|
threads[fd].error_func = error_func;
|
||||||
|
Loading…
Reference in New Issue
Block a user