From: Michael Sweet Date: Thu, 25 Aug 2016 19:09:12 +0000 (-0400) Subject: http*Connect did not work on Linux when cupsd was not running (Issue #4870) X-Git-Tag: v2.2.0~7 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4c3f8a9b89ceb2cb00f4e6b0a91e55598cb66747;p=thirdparty%2Fcups.git http*Connect did not work on Linux when cupsd was not running (Issue #4870) --- diff --git a/CHANGES.txt b/CHANGES.txt index 1c57d71af8..db33c7908f 100644 --- a/CHANGES.txt +++ b/CHANGES.txt @@ -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 diff --git a/cups/http-addrlist.c b/cups/http-addrlist.c index a1a7c5c12f..a760602bcc 100644 --- a/cups/http-addrlist.c +++ b/cups/http-addrlist.c @@ -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];