From: | Noah Misch <noah(at)leadboat(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | Robert Haas <robertmhaas(at)gmail(dot)com>, Marco Nenciarini <marco(dot)nenciarini(at)2ndquadrant(dot)it>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: pg_check_dir comments and implementation mismatch |
Date: | 2015-02-24 02:02:30 |
Message-ID: | 20150224020230.GA336018@tornado.leadboat.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sun, Feb 22, 2015 at 07:57:41PM -0500, Tom Lane wrote:
> Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> > On Fri, Feb 20, 2015 at 12:59 AM, Noah Misch <noah(at)leadboat(dot)com> wrote:
> >> On Mon, Feb 02, 2015 at 03:48:33PM -0500, Robert Haas wrote:
> >>> If readir() fails and closedir() succeeds, the return will be -1 but
> >>> errno will be 0.
>
> >> Out of curiosity, have you seen a closedir() implementation behave that way?
> >> It would violate C99 ("The value of errno is zero at program startup, but is
> >> never set to zero by any library function.") and POSIX.
>
> > No. Good point, I didn't think about that. I think this way is safer, though.
>
> While the spec forbids library functions from setting errno to zero, there
> is no restriction on them changing errno in other ways despite returning
> success; their exit-time value of errno is only well-defined if they fail.
> So we do need to preserve errno explicitly across closedir(), or we may
> report the wrong failure from readdir().
Yes. I'm happy with the commit itself.
From | Date | Subject | |
---|---|---|---|
Next Message | Andres Freund | 2015-02-24 02:10:18 | Re: deparsing utility commands |
Previous Message | Peter Geoghegan | 2015-02-24 01:47:04 | Re: INSERT ... ON CONFLICT UPDATE and logical decoding |