Re: 1.2b20-1: Close swap.state before renaming

From: Henrik Nordstrom <hno@dont-contact.us>
Date: Tue, 12 May 1998 01:02:18 +0200

--MimeMultipartBoundary
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit

Why do you want to keep the logs open during rename()? I don's see the
difference in the two approaces when done without interrupion.

rename
close
open

or

close
rename
open

I don't regard this as a Windows specific fix, rather as a fix for a bad
habit. I consider having files open when the name is deleted as magic on
all platforms. UNIX accepts this but why depend on it when it is not
needed?

/Henrik

Duane Wessels wrote:

> I put this in #ifdefs for Windows systems
>
> Index: store_dir.c
> ===================================================================
> RCS file: /surf1/CVS/squid/src/store_dir.c,v
> retrieving revision 1.66
> diff -w -u -r1.66 store_dir.c
> --- store_dir.c 1998/05/08 23:29:30 1.66
> +++ store_dir.c 1998/05/11 20:05:00
> @@ -743,6 +743,13 @@
> }
> safe_free(outbuf);
> safe_free(outbufoffset);
> +#ifdef _SQUID_MSWIN_
> + /*
> + * You can't rename open files on Microsoft "operating systems"
> + * so we close before renaming.
> + */
> + storeDirCloseSwapLogs();
> +#endif
> /* rename */
> for (dirn = 0; dirn < N; dirn++) {
> if (fd[dirn] < 0)
> @@ -752,7 +759,9 @@
> xstrerror(), new[dirn], cur[dirn]);
> }
> }
> +#ifndef _SQUID_MSWIN_
> storeDirCloseSwapLogs();
> +#endif
> if (reopen)
> storeDirOpenSwapLogs();
> stop = squid_curtime;
>
> Duane W.

--MimeMultipartBoundary--
Received on Tue Jul 29 2003 - 13:15:49 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:11:47 MST