summaryrefslogtreecommitdiffstats
path: root/main/squid/bug3577.patch
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2012-08-02 07:32:34 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2012-08-02 07:33:21 +0000
commit4ecda1eeb24bee90b13fb2c4a3ddac458c22ffd1 (patch)
tree6ed53162347c7f3d55c6ddf1caf8f36b9c7a3ced /main/squid/bug3577.patch
parentc0e41e982cb5e05760c89c20d51454b53086c74a (diff)
downloadaports-4ecda1eeb24bee90b13fb2c4a3ddac458c22ffd1.tar.bz2
aports-4ecda1eeb24bee90b13fb2c4a3ddac458c22ffd1.tar.xz
main/squid: fix file descriptor leak
ref #1297
Diffstat (limited to 'main/squid/bug3577.patch')
-rw-r--r--main/squid/bug3577.patch59
1 files changed, 59 insertions, 0 deletions
diff --git a/main/squid/bug3577.patch b/main/squid/bug3577.patch
new file mode 100644
index 000000000..35c97bd4b
--- /dev/null
+++ b/main/squid/bug3577.patch
@@ -0,0 +1,59 @@
+--- squid-3.2.0.18.orig/src/comm/ConnOpener.cc
++++ squid-3.2.0.18/src/comm/ConnOpener.cc
+@@ -131,6 +131,7 @@
+ }
+
+ if (temporaryFd_ >= 0) {
++ debugs(5, 4, HERE << conn_ << " closing temp FD " << temporaryFd_);
+ // it never reached fully open, so cleanup the FD handlers
+ // Note that comm_close() sequence does not happen for partially open FD
+ Comm::SetSelect(temporaryFd_, COMM_SELECT_WRITE, NULL, NULL, 0);
+@@ -141,6 +142,7 @@
+ }
+ fd_table[temporaryFd_].timeoutHandler = NULL;
+ fd_table[temporaryFd_].timeout = 0;
++ close(temporaryFd_);
+ fd_close(temporaryFd_);
+ temporaryFd_ = -1;
+ }
+--- squid-3.2.0.18.orig/src/forward.cc
++++ squid-3.2.0.18/src/forward.cc
+@@ -84,6 +84,11 @@
+
+ if (Comm::IsConnOpen(fwd->serverConnection())) {
+ comm_remove_close_handler(fwd->serverConnection()->fd, fwdServerClosedWrapper, fwd);
++ debugs(17, 3, HERE << "store entry aborted; closing " <<
++ fwd->serverConnection());
++ fwd->serverConnection()->close();
++ } else {
++ debugs(17, 7, HERE << "store entry aborted; no connection to close");
+ }
+ fwd->serverDestinations.clean();
+ fwd->self = NULL;
+--- squid-3.2.0.18.orig/src/http.cc
++++ squid-3.2.0.18/src/http.cc
+@@ -1067,7 +1067,7 @@
+ }
+
+ if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) {
+- // TODO: should we call abortTransaction() here?
++ abortTransaction("store entry aborted while reading reply");
+ return;
+ }
+
+@@ -1346,12 +1346,9 @@
+ }
+
+ if (EBIT_TEST(entry->flags, ENTRY_ABORTED)) {
+- /*
+- * The above writeReplyBody() call could ABORT this entry,
+- * in that case, the server FD should already be closed.
+- * there's nothing for us to do.
+- */
+- (void) 0;
++ // The above writeReplyBody() call may have aborted the store entry.
++ abortTransaction("store entry aborted while storing reply");
++ return;
+ } else
+ switch (persistentConnStatus()) {
+ case INCOMPLETE_MSG: {