[Top][All Lists]

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

Re: getcwd fixes for bugs in glibc, Solaris, OpenBSD, ...

From: Jim Meyering
Subject: Re: getcwd fixes for bugs in glibc, Solaris, OpenBSD, ...
Date: Fri, 26 Nov 2004 18:56:09 +0100

Paul Eggert <address@hidden> wrote:
> As a result of this patch, getcwd is limited only by available memory
> on hosts like Solaris that support AT_FDCWD.

But it has an unwelcome side effect: now, even on GNU libc systems,
this replacement getcwd will end up opening "..", then "../..",
etc. all the way up to "/", whereas the getcwd in libc.so just
copies the symlink value from /proc/self/cwd.  Of course, the
/proc/self/cwd approach doesn't work for directory names that
are longer than PATH_MAX.

The combination of increased efficiency and no need for a file
descriptor are compelling arguments to use a wrapper around the
system-supplied getcwd, when possible.  Or at least to try the
/proc/self/cwd trick before resorting to the more expensive,
robust code.

What do you think?

reply via email to

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