On Wed, 25 Nov 1998 01:40:53 +0100, Henrik Nordstrom wrote:
>Doug Nazar wrote:
>
>> One of the other main issues is that's you can't rename (or unlink)
>> open files. Unfortuanatly I'm having a little trouble following the
>> code paths for handling the file handle closing.
>
>This is not unique to the emx library. The same applies to CygWin on
>Windows. Search for _SQUID_MSWIN_ in store_dir.c (no idea why Duane
>insists on renaming open files when writing the clean log..)
I got that one. I changed the code to as follows
#if defined(_SQUID_MSWIN_) || defined(_SQUID_OS2_)
/*
* 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)
continue;
#ifdef _SQUID_OS2_
file_close(fd[dirn]);
fd[dirn] = -1;
if (unlink(cur[dirn]) < 0) {
debug(50, 0) ("storeDirWriteCleanLogs: unlinkd failed: %s,
%s\n",
xstrerror(), cur[dirn]);
}
#endif
if (rename(new[dirn], cur[dirn]) < 0) {
debug(50, 0) ("storeDirWriteCleanLogs: rename failed: %s,
%s -> %s\n",
xstrerror(), new[dirn], cur[dirn]);
}
}
#if !defined(_SQUID_MSWIN_) && !defined(_SQUID_OS2_)
storeDirCloseSwapLogs();
#endif
The current problem shows up in storeDirCloseTmpSwapLog(). The
file_close() doesn't always really close the file, and hence the unlink
fails (I have to unlink before the rename).
Doug Nazar
Phone: (416) 708-1578
Fax: (416) 708-8081
Received on Tue Nov 24 1998 - 17:41:14 MST
This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:43:19 MST