]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Add a workaround for Solaris in httpAddrConnect2 (Issue #156)
authorMichael R Sweet <michael.r.sweet@gmail.com>
Wed, 28 Apr 2021 15:57:14 +0000 (11:57 -0400)
committerMichael R Sweet <michael.r.sweet@gmail.com>
Wed, 28 Apr 2021 15:57:14 +0000 (11:57 -0400)
CHANGES.md
cups/http-addrlist.c

index e52432b8eef3ded28102a23e4f40ec03a555ede4..f35059a299f1eecb7a4c2123af29411bea9c6134 100644 (file)
@@ -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)
index 89b3d92fb6fc2bb1f57c552a875f494be76f8e02..54e2e9b5383a01fa9ae1a913771f0de2a1fa7463 100644 (file)
@@ -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"...
           */