Re: use binary mode on syslog pipe on windows to avoid upsetting chunking protocol - Mailing list pgsql-patches

From Tom Lane
Subject Re: use binary mode on syslog pipe on windows to avoid upsetting chunking protocol
Date
Msg-id 21267.1185808289@sss.pgh.pa.us
Whole thread Raw
In response to use binary mode on syslog pipe on windows to avoid upsetting chunking protocol  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: use binary mode on syslog pipe on windows to avoid upsetting chunking protocol
List pgsql-patches
Andrew Dunstan <andrew@dunslane.net> writes:
> This small patch makes the syslog pipe use binary mode on Windows

You need to think harder about where you are inserting the additions,
as these choices seem a bit random.  For instance here:

>       /* On Windows, need to interlock against data-transfer thread */
>   #ifdef WIN32
> +     _setmode(_fileno(fh), _O_TEXT); /* use CRLF line endings on Windows */
>       EnterCriticalSection(&sysfileSection);
>   #endif
>       fclose(syslogFile);

you have inserted a 100% unrelated action between a comment and the
statement it describes.  How readable will this code be to the next
person?  Far better to expend an additional #ifdef/#endif pair, if
needed, to put the call either by itself or with some code that it's
sensibly related to.  Being "WIN32" is not sufficient connection.

            regards, tom lane

pgsql-patches by date:

Previous
From: Tom Lane
Date:
Subject: Re: Export user visible function to make use of convert_to_scalar
Next
From: Gregory Stark
Date:
Subject: Re: Export user visible function to make use of convert_to_scalar