Re: Windows port merge - Miscellaneos changes [PATCH]

From: Robert Collins <robertc@dont-contact.us>
Date: 05 Feb 2003 08:31:41 +1100

On Tue, 2003-02-04 at 22:48, Guido Serassio wrote:
> Hi Robert,
>
> At 22.29 03/02/2003, Robert Collins wrote:
> >On Tue, 2003-02-04 at 05:00, Guido Serassio wrote:
> >
> >
> > > - File open is forced in binary mode
> >
> >This is a wrong way to tackle (whatever) problem you've encounteded. The
> >caller of this function specifies the mode as binary or text. I'm
> >applying the rest of the patches though.
>
> I have just found the reason of this:
> On Windows, when opening a file as O_TEXT, the resulting bytes count from a
> read() can be different from the real disk size.

Yep.

> So errorTryLoadText() in errorpage.cc and netdbReloadState() in net_db.c
> doesn't work correctly.
>
> So, attached there is a patch to fix this.
>
> Only a question, O_TEXT is really needed ?, or we can simply change O_TEXT
> to O_BINARY for all platforms ?

squid.conf and mime.conf should be O_TEXT. Textual log files should be
O_TEXT. database log files (swap.state for instance, and netdb) should
be O_BINARY for all.

> Another thing:
>
> I have discovered a bug in errorTryLoadText() when the read() fails: a NULL
> pointer is used in string functions. In the attached patch there is a fix
> to this too.
> The problem is present in 2.5 too.

Ok. Well, for now, lets make both netdb and errorTryLoadText use
O_BINARY. Long term errorTryLoadText should use text mode, as Henrik
indicated.

Rob.

-- 
GPG key available at: <http://users.bigpond.net.au/robertc/keys.txt>.

Received on Tue Feb 04 2003 - 14:31:51 MST

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