X-Git-Url: http://git.indexdata.com/?a=blobdiff_plain;f=comstack%2Ftcpip.c;h=cb24279c37d73684f44b8568cbf0dd6afc5e904c;hb=ac5f8ad9508f5b3ada38117b0da7ae23c650ab1e;hp=311b6e2ca5b42d4c099a391b0ac4af794a94b034;hpb=d83cfde85ccff3bfb2d45515516c9c15bc785ebb;p=yaz-moved-to-github.git diff --git a/comstack/tcpip.c b/comstack/tcpip.c index 311b6e2..cb24279 100644 --- a/comstack/tcpip.c +++ b/comstack/tcpip.c @@ -2,7 +2,7 @@ * Copyright (c) 1995-2002, Index Data * See the file LICENSE for details. * - * $Id: tcpip.c,v 1.45 2002-01-21 21:50:32 adam Exp $ + * $Id: tcpip.c,v 1.47 2002-06-12 19:42:38 adam Exp $ */ #include @@ -13,6 +13,7 @@ #endif #include #include +#include #if HAVE_OPENSSL_SSL_H #include #include @@ -125,10 +126,17 @@ COMSTACK tcpip_type(int s, int blocking, int protocol, void *vp) #ifdef WIN32 if (!(p->blocking = blocking) && ioctlsocket(s, FIONBIO, &tru) < 0) + return 0; #else - if (!(p->blocking = blocking) && fcntl(s, F_SETFL, O_NONBLOCK) < 0) + if (!(p->blocking = blocking)) + { + if (fcntl(s, F_SETFL, O_NONBLOCK) < 0) + return 0; +#ifndef MSG_NOSIGNAL + signal (SIGPIPE, SIG_IGN); +#endif + } #endif - return 0; p->io_pending = 0; p->iofile = s; @@ -671,6 +679,9 @@ int tcpip_get(COMSTACK h, char **buf, int *bufsize) #endif #endif || errno == EINPROGRESS +#ifdef __sun__ + || errno == ENOENT /* Sun's sometimes set errno to this */ +#endif ) { h->io_pending = CS_WANT_READ;