fixing looping in partial failing service (bug #1366775)

This commit is contained in:
Zdenek Dohnal 2016-09-22 11:27:58 +02:00
parent 8c714553f0
commit 29a9aee6cb
2 changed files with 61 additions and 1 deletions

54
cups-cpu-hammering.patch Normal file
View File

@ -0,0 +1,54 @@
diff -up cups-2.2.0/CHANGES.txt.cpu-hammering cups-2.2.0/CHANGES.txt
diff -up cups-2.2.0/cups/http-addrlist.c.cpu-hammering cups-2.2.0/cups/http-addrlist.c
--- cups-2.2.0/cups/http-addrlist.c.cpu-hammering 2016-09-19 19:56:54.074866957 +0200
+++ cups-2.2.0/cups/http-addrlist.c 2016-09-21 11:45:22.264775409 +0200
@@ -304,6 +304,8 @@ httpAddrConnect2(
if (result > 0)
{
+ http_addrlist_t *connaddr = NULL;
+
for (i = 0; i < nfds; i ++)
{
# ifdef HAVE_POLL
@@ -314,7 +316,7 @@ httpAddrConnect2(
# endif /* HAVE_POLL */
{
*sock = fds[i];
- addrlist = addrs[i];
+ connaddr = addrs[i];
# ifdef DEBUG
len = sizeof(peer);
@@ -322,11 +324,29 @@ httpAddrConnect2(
DEBUG_printf(("1httpAddrConnect2: Connected to %s:%d...", httpAddrString(&peer, temp, sizeof(temp)), httpAddrPort(&peer)));
# endif /* DEBUG */
}
- else
+# ifdef HAVE_POLL
+ else if (pfds[i].revents & (POLLERR | POLLHUP))
+# else
+ else if (FD_SET(fds[i], &error))
+# endif /* HAVE_POLL */
+ {
+ /*
+ * Error on socket, remove from the "pool"...
+ */
+
httpAddrClose(NULL, fds[i]);
+ nfds --;
+ if (i < nfds)
+ {
+ memmove(fds + i, fds + i + 1, (size_t)(nfds - i) * (sizeof(fds[0])));
+ memmove(addrs + i, addrs + i + 1, (size_t)(nfds - i) * (sizeof(addrs[0])));
+ }
+ i --;
+ }
}
- return (addrlist);
+ if (connaddr)
+ return (connaddr);
}
#endif /* O_NONBLOCK */

View File

@ -15,7 +15,7 @@ Summary: CUPS printing system
Name: cups
Epoch: 1
Version: 2.2.0
Release: 1%{?dist}
Release: 2%{?dist}
License: GPLv2
Url: http://www.cups.org/
Source0: https://github.com/apple/cups/releases/download/v%{VERSION}/cups-%{VERSION}-source.tar.gz
@ -62,6 +62,7 @@ Patch34: cups-avahi-no-threaded.patch
Patch35: cups-ipp-multifile.patch
Patch36: cups-web-devices-timeout.patch
Patch37: cups-synconclose.patch
Patch38: cups-cpu-hammering.patch
Patch100: cups-lspp.patch
@ -255,6 +256,8 @@ Sends IPP requests to the specified URI and tests and/or displays the results.
%patch36 -p1 -b .web-devices-timeout
# Set the default for SyncOnClose to Yes.
%patch37 -p1 -b .synconclose
# fixing looping in partial failing service (bug #1366775)
%patch38 -p1 -b .cpu-hammering
%if %{lspp}
# LSPP support.
@ -617,6 +620,9 @@ rm -f %{cups_serverbin}/backend/smb
%{_mandir}/man5/ipptoolfile.5.gz
%changelog
* Thu Sep 22 2016 Zdenek Dohnal <zdohnal@redhat.com> - 1:2.2.0-2
- fixing looping in partial failing service (bug #1366775)
* Thu Sep 15 2016 Jiri Popelka <jpopelka@redhat.com> - 1:2.2.0-1
- 2.2.0