Re: Nitpicking: unnecessary NULL-pointer check in pg_upgrade's controldata.c

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Andres Freund <andres(at)anarazel(dot)de>
Cc: Michael Paquier <michael(dot)paquier(at)gmail(dot)com>, PostgreSQL mailing lists <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Nitpicking: unnecessary NULL-pointer check in pg_upgrade's controldata.c
Date: 2015-06-26 13:44:14
Message-ID: CA+TgmoYbHDtMHGbq_yzS=E_WFjiC2AW+sfU+wmF+ArGFqrs4PA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jun 26, 2015 at 9:06 AM, Andres Freund <andres(at)anarazel(dot)de> wrote:
> On 2015-06-26 22:03:05 +0900, Michael Paquier wrote:
>> Hi,
>>
>> Coverity is nitpickingly pointing out the following thing:
>> --- a/src/bin/pg_upgrade/controldata.c
>> +++ b/src/bin/pg_upgrade/controldata.c
>> @@ -402,8 +402,7 @@ get_control_data(ClusterInfo *cluster, bool live_check)
>> }
>> }
>>
>> - if (output)
>> - pclose(output);
>> + pclose(output);
>> The thing is that output can never be NULL, pg_upgrade leaving with
>> pg_fatal before coming to this code path. Hence this NULL check could
>> be simply removed.
>
> FWIW, I think these type of coverity items should just be discarded with
> prejudice. Fixing them doesn't seem to buy anything and there's enough
> actually worthwhile stuff going on.

I don't mind committing patches for this kind of thing if it makes the
Coverity reports easier to deal with, which I gather that it does.

--
Robert Haas
EnterpriseDB: http://www.enterprisedb.com
The Enterprise PostgreSQL Company

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Heikki Linnakangas 2015-06-26 13:47:25 Re: Redesigning checkpoint_segments
Previous Message Heikki Linnakangas 2015-06-26 13:43:26 Re: Let PostgreSQL's On Schedule checkpoint write buffer smooth spread cycle by tuning IsCheckpointOnSchedule?