Re: pg_check_dir comments and implementation mismatch

From: Robert Haas <robertmhaas(at)gmail(dot)com>
To: Marco Nenciarini <marco(dot)nenciarini(at)2ndquadrant(dot)it>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_check_dir comments and implementation mismatch
Date: 2015-02-17 15:32:42
Message-ID: CA+TgmoY2mTN03dZT3ue4NyU+GVAd-YzVRosiSxGFjUbnSUDcBA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Feb 12, 2015 at 9:31 AM, Marco Nenciarini
<marco(dot)nenciarini(at)2ndquadrant(dot)it> wrote:
> Il 02/02/15 21:48, Robert Haas ha scritto:
>> On Sat, Jan 31, 2015 at 8:28 AM, Marco Nenciarini
>> <marco(dot)nenciarini(at)2ndquadrant(dot)it> wrote:
>>> Il 30/01/15 03:54, Michael Paquier ha scritto:
>>>> On Fri, Jan 30, 2015 at 2:49 AM, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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.
>>
>
> The attached patch should fix it.

Looks nice. Committed.

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

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Stephen Frost 2015-02-17 15:34:03 Re: Auditing extension for PostgreSQL (Take 2)
Previous Message Simon Riggs 2015-02-17 15:23:17 Re: pgaudit - an auditing extension for PostgreSQL