bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: POSIX 2008 available, openat


From: Jim Meyering
Subject: Re: POSIX 2008 available, openat
Date: Mon, 15 Dec 2008 08:40:20 +0100

"James Youngman" <address@hidden> wrote:
> On Mon, Dec 15, 2008 at 12:18 AM, Bruno Haible <address@hidden> wrote:
>> However, for openat-die.c I don't see a good replacement. In particular, I
>> don't see a way how openat_restore_fail() could be handled in library code.
>> A program cannot simply continue when its current directory is different from
>> what it was expecting. And errno values don't adequately capture this
>> situation. ?? Any ideas?
>
> I would suggest simply avoiding the case where save_cwd() calls
> xgetcwd().  Certainly this will make openat() fail for directories
> (other than the original current directory) which are not readable.
> However, apart from that restriction, using only fchdir  does have the
> advantage that we know that restoring the current directory can't
> fail.   (It can fail IIRC on SunOS, but I think we don't support the
> affected versions any more).

This would also cause failure when emulating openat support and running
from an absolute directory whose name is longer than PATH_MAX.

The real solution is to add support for POSIX.2008's proposed
O_SEARCH open flag to our favorite kernels.




reply via email to

[Prev in Thread] Current Thread [Next in Thread]