Re: use binary mode on syslog pipe on windows to avoid upsetting chunking protocol

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>
Cc: "Patches (PostgreSQL)" <pgsql-patches(at)postgresql(dot)org>
Subject: Re: use binary mode on syslog pipe on windows to avoid upsetting chunking protocol
Date: 2007-07-30 15:11:29
Message-ID: 21267.1185808289@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-patches

Andrew Dunstan <andrew(at)dunslane(dot)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

In response to

Responses

Browse pgsql-patches by date

  From Date Subject
Next Message Gregory Stark 2007-07-30 15:22:13 Re: Export user visible function to make use of convert_to_scalar
Previous Message Tom Lane 2007-07-30 15:00:18 Re: Export user visible function to make use of convert_to_scalar