From: Michael R Sweet Date: Wed, 28 Apr 2021 15:57:14 +0000 (-0400) Subject: Add a workaround for Solaris in httpAddrConnect2 (Issue #156) X-Git-Tag: v2.4b1~130 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e50230a1169f64c86cb471645e5825293f1b8e95;p=thirdparty%2Fcups.git Add a workaround for Solaris in httpAddrConnect2 (Issue #156) --- diff --git a/CHANGES.md b/CHANGES.md index e52432b8ee..f35059a299 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -35,6 +35,7 @@ CUPS v2.4rc1 (Pending) negotiation failed (Apple #5915) - The IPP backend now retries Validate-Job requests (Issue #132) - Reverted USB read limit enforcement change from CUPS 2.2.12 (Issue #72) +- Added a workaround for Solaris in `httpAddrConnect2` (Issue #156) - Now use a 60 second timeout for reading USB backchannel data (Issue #160) - The USB backend now tries harder to find a serial number (Issue #170) - Fixed `@IF(name)` handling in `cupsd.conf` (Apple #5918) diff --git a/cups/http-addrlist.c b/cups/http-addrlist.c index 89b3d92fb6..54e2e9b538 100644 --- a/cups/http-addrlist.c +++ b/cups/http-addrlist.c @@ -337,6 +337,18 @@ httpAddrConnect2( else if (FD_ISSET(fds[i], &error_set)) # endif /* HAVE_POLL */ { +# ifdef __sun + // Solaris incorrectly returns errors when you poll() a socket that is + // still connecting. This check prevents us from removing the socket + // from the pool if the "error" is EINPROGRESS... + int sockerr; // Current error on socket + socklen_t socklen = sizeof(serr); + // Size of error variable + + if (!getsockopt(fds[i], SOL_SOCKET, SO_ERROR, &sockerr, &socklen) && (!sockerr || sockerr == EINPROGRESS)) + continue; // Not an error +# endif // __sun + /* * Error on socket, remove from the "pool"... */