Re: pg_archivecleanup bug

From: Bruce Momjian <bruce(at)momjian(dot)us>
To: Kevin Grittner <kgrittn(at)ymail(dot)com>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_archivecleanup bug
Date: 2013-12-10 16:05:02
Message-ID: 20131210160502.GB14664@momjian.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Dec 5, 2013 at 12:06:07PM -0800, Kevin Grittner wrote:
> An EDB customer reported a problem with pg_archivecleanup which I
> have looked into and found a likely cause.  It is, in any event, a
> bug which I think should be fixed.  It has to do with our use of
> the readdir() function:
>
> http://pubs.opengroup.org/onlinepubs/7908799/xsh/readdir_r.html
>
> These are the relevant bits:
>
> | Applications wishing to check for error situations should set
> | errno to 0 before calling readdir(). If errno is set to non-zero
> | on return, an error occurred.
>
> | Upon successful completion, readdir() returns a pointer to an
> | object of type struct dirent. When an error is encountered, a
> | null pointer is returned and errno is set to indicate the error.
> | When the end of the directory is encountered, a null pointer is
> | returned and errno is not changed.

Wow, another case where errno clearing is necessary. We were just
looking this requirement for getpwuid() last week.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://enterprisedb.com

+ Everyone has their own god. +

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Noah Misch 2013-12-10 17:27:11 Re: Dynamic Shared Memory stuff
Previous Message Merlin Moncure 2013-12-10 15:17:59 Re: JSON decoding plugin