Realpath & context sensitive symlinks

Paul Eggert eggert@twinsun.com
Thu Sep 27 12:26:00 GMT 2001


> Date: Thu, 27 Sep 2001 15:03:12 -0400
> From: Daniel Jacobowitz <drow@mvista.com>
> 
> On Thu, Sep 27, 2001 at 11:57:11AM -0700, Paul Eggert wrote:
> > Realpath could invoke the 'resolvepath' system call, if it is available.
> > That would be more reliable than the chdir/getcwd hack that you suggested.
> 
> I can certainly see it being more elegant, but in what way is it more
> reliable?

chdir, getcwd, and chdir back can be interrupted (which means that
your signal handler will run in the wrong directory), or can fail for
reasons unrelated to the realpath (e.g. you may not be able to chdir
back -- then what do you do?).

How about getting resolvepath into Linux?  I think you can build a
good case for it.



More information about the Libc-alpha mailing list