Re: new compiler warnings

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, Andrew Dunstan <andrew(at)dunslane(dot)net>, Kevin Grittner <Kevin(dot)Grittner(at)wicourts(dot)gov>, pgsql(at)j-davis(dot)com, pgsql-hackers(at)postgresql(dot)org
Subject: Re: new compiler warnings
Date: 2011-10-18 16:26:51
Message-ID: 6357.1318955211@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Tue, Oct 18, 2011 at 10:06 AM, Peter Eisentraut <peter_e(at)gmx(dot)net> wrote:
>> No, I believe we are OK everywhere else. We are only ignoring the
>> result in cases where we are trying to report errors in the first place.

> The relevant code is:

> while (len > PIPE_MAX_PAYLOAD)
> {
> p.proto.is_last = (dest == LOG_DESTINATION_CSVLOG ? 'F' : 'f');
> p.proto.len = PIPE_MAX_PAYLOAD;
> memcpy(p.proto.data, data, PIPE_MAX_PAYLOAD);
> write(fd, &p, PIPE_HEADER_SIZE + PIPE_MAX_PAYLOAD);
> data += PIPE_MAX_PAYLOAD;
> len -= PIPE_MAX_PAYLOAD;
> }

> Which it seems to me we could change by doing rc = write(). Then if
> rc <= 0, we bail out. If not, we add and subtract rc, rather than
> PIPE_MAX_PAYLOAD. That would be barely more code, probably safer, and
> would silence the warning.

And it would break the code. The whole point here is that the message
must be sent indivisibly.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kevin Grittner 2011-10-18 16:29:45 Re: new compiler warnings
Previous Message Fujii Masao 2011-10-18 16:24:42 Re: pg_ctl restart - behaviour based on wrong instance