On Wed, Jan 14, 2015 at 9:27 PM, Michael Paquier
wrote:
> On Thu, Jan 15, 2015 at 7:13 AM, Robert Haas wrote:
>> Instead of doing this:
>>
>> if (len < sizeof(buf))
>> buf[len] = '\0';
>>
>> ...I would suggest making the size of the buffer one greater than the
>> size of the read(), a
On Thu, Jan 15, 2015 at 7:13 AM, Robert Haas wrote:
> Instead of doing this:
>
> if (len < sizeof(buf))
> buf[len] = '\0';
>
> ...I would suggest making the size of the buffer one greater than the
> size of the read(), and then always nul-terminating the buffer. It
> seems to me that
On Wed, Jan 14, 2015 at 8:24 AM, Michael Paquier
wrote:
> In pg_standby.c, we use a 32-byte buffer in CheckForExternalTrigger to
> which is read the content of the trigger file defined by -f:
> CheckForExternalTrigger(void)
> {
> charbuf[32];
> [...]
> if ((len = read(fd, buf,
Hi all,
In pg_standby.c, we use a 32-byte buffer in CheckForExternalTrigger to
which is read the content of the trigger file defined by -f:
CheckForExternalTrigger(void)
{
charbuf[32];
[...]
if ((len = read(fd, buf, sizeof(buf))) < 0)
{
stuff();
}
if (len <