Re: pg_check_dir comments and implementation mismatch - Mailing list pgsql-hackers

From Robert Haas
Subject Re: pg_check_dir comments and implementation mismatch
Date
Msg-id CA+TgmobV_i-0H=OEtAbEbkkrTOSrvCUXE2Ji-nQdzyQDOLQuAA@mail.gmail.com
Whole thread Raw
In response to Re: pg_check_dir comments and implementation mismatch  (Marco Nenciarini <marco.nenciarini@2ndquadrant.it>)
Responses Re: pg_check_dir comments and implementation mismatch  (Marco Nenciarini <marco.nenciarini@2ndquadrant.it>)
Re: pg_check_dir comments and implementation mismatch  (Noah Misch <noah@leadboat.com>)
List pgsql-hackers
On Sat, Jan 31, 2015 at 8:28 AM, Marco Nenciarini
<marco.nenciarini@2ndquadrant.it> wrote:
> Il 30/01/15 03:54, Michael Paquier ha scritto:
>> On Fri, Jan 30, 2015 at 2:49 AM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>>> There is at least one other bug in that function now that I look at it:
>>> in event of a readdir() failure, it neglects to execute closedir().
>>> Perhaps not too significant since all existing callers will just exit()
>>> anyway after a failure, but still ...
>> I would imagine that code scanners like coverity or similar would not
>> be happy about that. ISTM that it is better to closedir()
>> appropriately in all the code paths.
>>
>
> I've attached a new version of the patch fixing the missing closedir on
> readdir error.

If readir() fails and closedir() succeeds, the return will be -1 but
errno will be 0.

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



pgsql-hackers by date:

Previous
From: Robert Haas
Date:
Subject: Re: Release note bloat is getting out of hand
Next
From: David Steele
Date:
Subject: Re: pgaudit - an auditing extension for PostgreSQL