This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: atime preservation
- From: Ian Turner <ian at zmanda dot com>
- To: "Dmitry V. Levin" <ldv at altlinux dot org>
- Cc: libc-alpha at sources dot redhat dot com
- Date: Wed, 28 Sep 2005 15:58:47 -0700
- Subject: Re: atime preservation
- References: <20050928221831.GA30960@basalt.office.altlinux.org>
On Wednesday 28 September 2005 15:18, Dmitry V. Levin wrote:
> On Wed, Sep 28, 2005 at 02:20:57PM -0700, Ulrich Drepper wrote:
> > Paul Eggert wrote:
> > > I suggest the name "fdopendir" instead
> >
> > I implemented fdopendir() on the trunk. A test case even verifies that
> > reading a dir doesn't change its atime.
>
> This implementation may close the descriptor passed to fdopendir(), e.g.
> in case of fcntl() or malloc() failure. In case of success, it will set
> FD_CLOEXEC on this descriptor. Both seems strange for me.
Seems to be that the documentation of this call should make it clear that once
fdopendir() returns success, you don't get your fd back. So setting
FD_CLOEXEC seems quite reasonable.
Closing the descriptor in the case of failure, on the other hand, does not. If
there's a problem, the solution is to leave the fd as-was, rather than
closing it.