Re: new compiler warnings - Mailing list pgsql-hackers

From Tom Lane
Subject Re: new compiler warnings
Date
Msg-id 6357.1318955211@sss.pgh.pa.us
Whole thread Raw
In response to Re: new compiler warnings  (Robert Haas <robertmhaas@gmail.com>)
Responses Re: new compiler warnings
Re: new compiler warnings
List pgsql-hackers
Robert Haas <robertmhaas@gmail.com> writes:
> On Tue, Oct 18, 2011 at 10:06 AM, Peter Eisentraut <peter_e@gmx.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


pgsql-hackers by date:

Previous
From: Fujii Masao
Date:
Subject: Re: pg_ctl restart - behaviour based on wrong instance
Next
From: "Kevin Grittner"
Date:
Subject: Re: new compiler warnings