mirror of
https://github.com/rkd77/elinks.git
synced 2024-12-04 14:46:47 -05:00
select_loop: If select fails, save its errno.
This commit is contained in:
parent
4b156678c6
commit
bad1b588dd
@ -251,11 +251,15 @@ select_loop(void (*init)(void))
|
|||||||
|
|
||||||
n = select(w_max, &x_read, &x_write, &x_error, timeout);
|
n = select(w_max, &x_read, &x_write, &x_error, timeout);
|
||||||
if (n < 0) {
|
if (n < 0) {
|
||||||
|
/* The following calls (especially gettext)
|
||||||
|
* might change errno. */
|
||||||
|
const int errno_from_select = errno;
|
||||||
|
|
||||||
critical_section = 0;
|
critical_section = 0;
|
||||||
uninstall_alarm();
|
uninstall_alarm();
|
||||||
if (errno != EINTR) {
|
if (errno_from_select != EINTR) {
|
||||||
ERROR(gettext("The call to %s failed: %d (%s)"),
|
ERROR(gettext("The call to %s failed: %d (%s)"),
|
||||||
"select()", errno, (unsigned char *) strerror(errno));
|
"select()", errno_from_select, (unsigned char *) strerror(errno_from_select));
|
||||||
if (++select_errors > 10) /* Infinite loop prevention. */
|
if (++select_errors > 10) /* Infinite loop prevention. */
|
||||||
INTERNAL(gettext("%d select() failures."),
|
INTERNAL(gettext("%d select() failures."),
|
||||||
select_errors);
|
select_errors);
|
||||||
|
Loading…
Reference in New Issue
Block a user