bug-gnulib
[Top][All Lists]
Advanced

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

Re: POSIX 2008 available, openat


From: James Youngman
Subject: Re: POSIX 2008 available, openat
Date: Mon, 15 Dec 2008 00:50:03 +0000

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).

Coincidentally this probably also breaks the dependency on xgetcwd().

James.




reply via email to

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