bug-gnulib
[Top][All Lists]
Advanced

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

Re: FYI: new openat-like function: mkdirat


From: Daniel Jacobowitz
Subject: Re: FYI: new openat-like function: mkdirat
Date: Wed, 30 Nov 2005 19:55:05 -0500
User-agent: Mutt/1.5.8i

On Wed, Nov 30, 2005 at 11:34:40PM +0100, Jim Meyering wrote:
> Roland McGrath <address@hidden> wrote:
> >> So I guess the exec*at business would ultimately be more complicated,
> >> with two file descriptor parameters: one identifying the working
> >> directory, and another by which to interpret the first parameter
> >> if it's a relative file name.
> >
> > It seems adequate to just use chdir/fchdir for changing cwd, and then
> > execveat given the file name (you can get an fd for the original cwd before
> > chdir, for relative paths in exec).
> 
> Using chdir/fchdir is _usually_ adequate.
> But what about the other times?  Sometimes you *cannot*
> get an fd (or an absolute name) for an initial cwd.
> 
> Changing cwd is problematic whenever:
> 
>   - your code must be thread-safe
> 
>   - it would be impossible to restore the initial working
>     directory, once it's been changed -- thereafter, no reference
>     to a `.'-relative name can be resolved.

You're talking about exec.  If you're going to use execve anyway,
there's no way you need your old initial working directory back, is
there?

-- 
Daniel Jacobowitz
CodeSourcery, LLC




reply via email to

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