From: wessels <> Date: Wed, 25 Feb 1998 04:13:43 +0000 (+0000) Subject: we may have a FD leak. lets cache the FD_CLOSE_REQUEST bit and X-Git-Tag: SQUID_3_0_PRE1~4007 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=68c21f7152d377b3e0cf5a06b95f86e0c7096db0;p=thirdparty%2Fsquid.git we may have a FD leak. lets cache the FD_CLOSE_REQUEST bit and close it after the callback if we have to. --- diff --git a/src/disk.cc b/src/disk.cc index 975b07093d..03904ca385 100644 --- a/src/disk.cc +++ b/src/disk.cc @@ -1,6 +1,6 @@ /* - * $Id: disk.cc,v 1.107 1998/02/24 16:39:22 wessels Exp $ + * $Id: disk.cc,v 1.108 1998/02/24 21:13:43 wessels Exp $ * * DEBUG: section 6 Disk I/O Routines * AUTHOR: Harvest Derived @@ -296,6 +296,7 @@ diskHandleWriteComplete(void *data, int len, int errcode) dwrite_q *q = fdd->write_q; int status = DISK_OK; int do_callback; + int do_close; errno = errcode; debug(6, 3) ("diskHandleWriteComplete: FD %d len = %d\n", fd, len); #if USE_ASYNC_IO @@ -393,6 +394,7 @@ diskHandleWriteComplete(void *data, int len, int errcode) commSetSelect(fd, COMM_SELECT_WRITE, diskHandleWrite, NULL, 0); EBIT_SET(F->flags, FD_WRITE_DAEMON); } + do_close = EBIT_TEST(F->flags, FD_CLOSE_REQUEST); if (fdd->wrt_handle) { if (fdd->wrt_handle_data == NULL) do_callback = 1; @@ -410,7 +412,7 @@ diskHandleWriteComplete(void *data, int len, int errcode) */ return; } - if (EBIT_TEST(F->flags, FD_CLOSE_REQUEST)) + if (do_close) file_close(fd); }