diff options
-rw-r--r-- | configure.ac | 2 | ||||
-rw-r--r-- | src/misc.c | 131 |
2 files changed, 48 insertions, 85 deletions
diff --git a/configure.ac b/configure.ac index 387a66b..e131ba8 100644 --- a/configure.ac +++ b/configure.ac @@ -30,7 +30,7 @@ XORG_WITH_XSLTPROC XORG_CHECK_SGML_DOCTOOLS(1.8) # Obtain compiler/linker options for dependencies -PKG_CHECK_MODULES(ICE, xproto xtrans) +PKG_CHECK_MODULES(ICE, [xproto >= 7.0.25 xtrans]) # Checks for library functions. AC_SEARCH_LIBS([arc4random_buf], [bsd]) @@ -63,7 +63,52 @@ IceAllocScratch ( return (iceConn->scratch); } +/* + * Fatal IO error. First notify each protocol's IceIOErrorProc + * callback, then invoke the application IO error handler. + */ + +static void _X_COLD +IceFatalIOError ( + IceConn iceConn +) +{ + iceConn->io_ok = False; + + if (iceConn->connection_status == IceConnectPending) + { + /* + * Don't invoke IO error handler if we are in the + * middle of a connection setup. + */ + + return; + } + + if (iceConn->process_msg_info) + { + for (int i = iceConn->his_min_opcode; + i <= iceConn->his_max_opcode; i++) + { + _IceProcessMsgInfo *process; + + process = &iceConn->process_msg_info[i - iceConn->his_min_opcode]; + if ((process != NULL) && process->in_use) + { + IceIOErrorProc IOErrProc = process->accept_flag ? + process->protocol->accept_client->io_error_proc : + process->protocol->orig_client->io_error_proc; + + if (IOErrProc) + (*IOErrProc) (iceConn); + } + } + } + + (*_IceIOErrorHandler) (iceConn); + return; +} /* * Output/Input buffer functions @@ -246,48 +291,7 @@ _IceRead ( } else { - /* - * Fatal IO error. First notify each protocol's IceIOErrorProc - * callback, then invoke the application IO error handler. - */ - - iceConn->io_ok = False; - - if (iceConn->connection_status == IceConnectPending) - { - /* - * Don't invoke IO error handler if we are in the - * middle of a connection setup. - */ - - return (1); - } - - if (iceConn->process_msg_info) - { - int i; - - for (i = iceConn->his_min_opcode; - i <= iceConn->his_max_opcode; i++) - { - _IceProcessMsgInfo *process; - - process = &iceConn->process_msg_info[ - i - iceConn->his_min_opcode]; - - if ((process != NULL) && process->in_use) - { - IceIOErrorProc IOErrProc = process->accept_flag ? - process->protocol->accept_client->io_error_proc : - process->protocol->orig_client->io_error_proc; - - if (IOErrProc) - (*IOErrProc) (iceConn); - } - } - } - - (*_IceIOErrorHandler) (iceConn); + IceFatalIOError (iceConn); return (1); } } @@ -354,48 +358,7 @@ _IceWrite ( #ifdef WIN32 errno = WSAGetLastError(); #endif - /* - * Fatal IO error. First notify each protocol's IceIOErrorProc - * callback, then invoke the application IO error handler. - */ - - iceConn->io_ok = False; - - if (iceConn->connection_status == IceConnectPending) - { - /* - * Don't invoke IO error handler if we are in the - * middle of a connection setup. - */ - - return; - } - - if (iceConn->process_msg_info) - { - int i; - - for (i = iceConn->his_min_opcode; - i <= iceConn->his_max_opcode; i++) - { - _IceProcessMsgInfo *process; - - process = &iceConn->process_msg_info[ - i - iceConn->his_min_opcode]; - - if (process->in_use) - { - IceIOErrorProc IOErrProc = process->accept_flag ? - process->protocol->accept_client->io_error_proc : - process->protocol->orig_client->io_error_proc; - - if (IOErrProc) - (*IOErrProc) (iceConn); - } - } - } - - (*_IceIOErrorHandler) (iceConn); + IceFatalIOError (iceConn); return; } |