summaryrefslogtreecommitdiff
path: root/xc/lib/X11/XlibInt.c
diff options
context:
space:
mode:
Diffstat (limited to 'xc/lib/X11/XlibInt.c')
-rw-r--r--xc/lib/X11/XlibInt.c25
1 files changed, 17 insertions, 8 deletions
diff --git a/xc/lib/X11/XlibInt.c b/xc/lib/X11/XlibInt.c
index 04977d997..61e5bc1f2 100644
--- a/xc/lib/X11/XlibInt.c
+++ b/xc/lib/X11/XlibInt.c
@@ -1,4 +1,4 @@
-/* $TOG: XlibInt.c /main/186 1998/02/06 18:02:22 kaleb $ */
+/* $Xorg: XlibInt.c,v 1.7 2000/08/17 19:45:07 cpqbld Exp $ */
/*
Copyright 1985, 1986, 1987, 1998 The Open Group
@@ -22,7 +22,7 @@ other dealings in this Software without prior written authorization
from The Open Group.
*/
-/* $XFree86: xc/lib/X11/XlibInt.c,v 3.23 2000/11/30 23:29:59 dawes Exp $ */
+/* $XFree86: xc/lib/X11/XlibInt.c,v 3.25 2001/01/25 16:21:44 keithp Exp $ */
/*
* XlibInt.c - Internal support routines for the C subroutine
@@ -588,10 +588,18 @@ static void _XFlushInt (dpy, cv)
register char *bufindex;
_XExtension *ext;
- if (dpy->flags & XlibDisplayIOError) {
- dpy->bufptr = dpy->buffer; /* reset to avoid buffer overflows */
+ /* This fix resets the bufptr to the front of the buffer so
+ * additional appends to the bufptr will not corrupt memory. Since
+ * the server is down, these appends are no-op's anyway but
+ * callers of _XFlush() are not verifying this before they call it.
+ */
+ if (dpy->flags & XlibDisplayIOError)
+ {
+ dpy->bufptr = dpy->buffer;
+ dpy->last_req = (char *)&_dummy_request;
return;
}
+
#ifdef XTHREADS
while (dpy->flags & XlibDisplayWriting) {
if (dpy->lock) {
@@ -743,6 +751,7 @@ _XEventsQueued (dpy, mode)
*/
if (!pend && !dpy->qlen && ++dpy->conn_checker >= XCONN_CHECK_FREQ)
{
+ int result;
#ifdef USE_POLL
struct pollfd filedes;
#else
@@ -754,14 +763,14 @@ _XEventsQueued (dpy, mode)
#ifdef USE_POLL
filedes.fd = dpy->fd;
filedes.events = POLLIN;
- if ((pend = poll(&filedes, 1, 0)))
+ if ((result = poll(&filedes, 1, 0)))
#else
FD_ZERO(&r_mask);
FD_SET(dpy->fd, &r_mask);
- if (pend = Select(dpy->fd + 1, &r_mask, NULL, NULL, &zero_time))
+ if ((result = Select(dpy->fd + 1, &r_mask, NULL, NULL, &zero_time)))
#endif
{
- if (pend > 0)
+ if (result > 0)
{
if (_X11TransBytesReadable(dpy->trans_conn, &pend) < 0)
_XIOError(dpy);
@@ -769,7 +778,7 @@ _XEventsQueued (dpy, mode)
if (!pend)
pend = SIZEOF(xReply);
}
- else if (pend < 0 && !ECHECK(EINTR))
+ else if (result < 0 && !ECHECK(EINTR))
_XIOError(dpy);
}
}