]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
http*Connect did not work on Linux when cupsd was not running (Issue #4870)
authorMichael Sweet <michael.r.sweet@gmail.com>
Thu, 25 Aug 2016 19:09:12 +0000 (15:09 -0400)
committerMichael Sweet <michael.r.sweet@gmail.com>
Thu, 25 Aug 2016 19:09:12 +0000 (15:09 -0400)
CHANGES.txt
cups/http-addrlist.c

index 1c57d71af8d1ad81d0ad8576e1a434e39f25606a..db33c7908f4d4c55b282f3dda17e4ab1d43ad12e 100644 (file)
@@ -5,6 +5,8 @@ CHANGES IN CUPS V2.2.0
 
        - Normalized the TLS certificate validation code and added additional
          error messages to aid troubleshooting.
+       - http*Connect did not work on Linux when cupsd was not running
+         (Issue #4870)
 
 
 CHANGES IN CUPS V2.2rc1
index a1a7c5c12fecef8c5afc557ff8e0dec034224e18..a760602bcc75a761ed3d005c791793a874a29679 100644 (file)
@@ -78,7 +78,8 @@ httpAddrConnect2(
   struct pollfd                pfds[100];      /* Polled file descriptors */
 #  else
   fd_set               input_set,      /* select() input set */
-                       output_set;     /* select() output set */
+                       output_set,     /* select() output set */
+                       error_set;      /* select() error set */
   struct timeval       timeout;        /* Timeout */
 #  endif /* HAVE_POLL */
 #endif /* O_NONBLOCK */
@@ -282,11 +283,12 @@ httpAddrConnect2(
       for (i = 0; i < nfds; i ++)
        FD_SET(fds[i], &input_set);
       output_set = input_set;
+      error_set  = input_set;
 
       timeout.tv_sec  = 0;
       timeout.tv_usec = (addrlist ? 100 : remaining > 250 ? 250 : remaining) * 1000;
 
-      result = select(max_fd + 1, &input_set, &output_set, NULL, &timeout);
+      result = select(max_fd + 1, &input_set, &output_set, &error_set, &timeout);
 
       DEBUG_printf(("1httpAddrConnect2: select() returned %d (%d)", result, errno));
 #  endif /* HAVE_POLL */
@@ -303,9 +305,9 @@ httpAddrConnect2(
       {
 #  ifdef HAVE_POLL
        DEBUG_printf(("pfds[%d].revents=%x\n", i, pfds[i].revents));
-       if (pfds[i].revents)
+       if (pfds[i].revents && !(pfds[i].revents & (POLLERR | POLLHUP)))
 #  else
-       if (FD_ISSET(fds[i], &input))
+       if (FD_ISSET(fds[i], &input) && !FD_ISSET(fds[i], &error))
 #  endif /* HAVE_POLL */
        {
          *sock    = fds[i];