[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
LYNX-DEV ^Z patch for 2.7.1
From: |
John E. Davis |
Subject: |
LYNX-DEV ^Z patch for 2.7.1 |
Date: |
Mon, 12 May 1997 19:41:09 -0400 |
From the PROBLEMS file:
Control-Z on Unix can cause aberrant behavior. If you encounter
I think this is due to not handling the select system call properly.
If ^Z is pressed while select is being called, after resumption,
select will return -1 with errno set to EINTR. This situation does
not appear to be handled properly. Below I have attached a patch to
lynx2-7-1/WWW/Library/Implementation/HTTCP.c that should fix this.
I patched the file in two places. Basically the trick is to replace:
timeout.tv_sec = 0;
timeout.tv_usec = 100000;
FD_ZERO(&readfds);
FD_SET(fildes, &readfds);
ret = select(FD_SETSIZE, (void *)&readfds, NULL, NULL, &timeout);
if (ret == -1)
return -1; /* failed */
with:
do
{
timeout.tv_sec = 0;
timeout.tv_usec = 100000;
FD_ZERO(&readfds);
FD_SET(fildes, &readfds);
ret = select(FD_SETSIZE, (void *)&readfds, NULL, NULL, &timeout);
}
while ((ret == -1)
&& (errno == EINTR));
if (ret == -1)
return -1; /* failed */
Here is the complete patch:
--- HTTCP.c.orig Wed Feb 26 12:44:28 1997
+++ HTTCP.c Mon May 12 19:15:24 1997
@@ -769,6 +769,13 @@
else
#endif /* SOCKS */
ret = select(FD_SETSIZE, NULL, (void *)&writefds, NULL, &timeout);
+
+ /* If we suspend, then it is possible that select will be
+ * interrupted. Allow for this possibility.
+ */
+ if ((ret == -1) && (errno == EINTR))
+ continue;
+
/*
** Again according to the Sun and Motorola man pagse for connect:
** EALREADY The socket is non-blocking and a previ-
@@ -923,16 +930,22 @@
return HT_INTERRUPTED;
}
- timeout.tv_sec = 0;
- timeout.tv_usec = 100000;
- FD_ZERO(&readfds);
- FD_SET(fildes, &readfds);
+ do
+ {
+ timeout.tv_sec = 0;
+ timeout.tv_usec = 100000;
+ FD_ZERO(&readfds);
+ FD_SET(fildes, &readfds);
#ifdef SOCKS
- if (socks_flag)
- ret = Rselect(FD_SETSIZE, (void *)&readfds, NULL, NULL, &timeout);
- else
+ if (socks_flag)
+ ret = Rselect(FD_SETSIZE, (void *)&readfds, NULL, NULL, &timeout);
+ else
#endif /* SOCKS */
- ret = select(FD_SETSIZE, (void *)&readfds, NULL, NULL, &timeout);
+ ret = select(FD_SETSIZE, (void *)&readfds, NULL, NULL, &timeout);
+ }
+ while ((ret == -1)
+ && (errno == EINTR));
+
if (ret < 0) {
return -1;
} else if (ret > 0) {
;
; To UNSUBSCRIBE: Send a mail message to address@hidden
; with "unsubscribe lynx-dev" (without the
; quotation marks) on a line by itself.
;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- LYNX-DEV ^Z patch for 2.7.1,
John E. Davis <=