On 01/24/2013 12:35 PM, Assaf Gordon wrote: > With this patch, the recursive loop is gone, but it leads to another bug: > descending into the directory (due to "-r") doesn't work.
Thanks, can you please try this patch instead? It's a bit more drastic, but I hope it fixes the loop without introducing that other bug. This is a gnulib patch, so it fixes a 'ChangeLog' file that you don't have -- please don't worry about that part. --- ChangeLog | 6 ++++++ lib/getcwd.c | 6 +++--- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index bb7a142..6db18b4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2013-01-27 Paul Eggert <egg...@cs.ucla.edu> + getcwd: break a recursive loop between fdopendir and save_cwd + Reported for Mac OS X 10.6.8 by Assaf Gordon in + <http://bugs.gnu.org/13516>. + * lib/getcwd.c (HAVE_OPENAT_SUPPORT): Do not define if + !HAVE_OPENAT && !HAVE_FDOPENDIR. + futimens-tests, utimens-tests: Depend on gettext. This works around a problem introduced in my 2013-01-12 patch, which added @LIBINTL@ to these modules. diff --git a/lib/getcwd.c b/lib/getcwd.c index a4cbe01..4b78138 100644 --- a/lib/getcwd.c +++ b/lib/getcwd.c @@ -28,9 +28,9 @@ #include <fcntl.h> /* For AT_FDCWD on Solaris 9. */ /* If this host provides the openat function or if we're using the - gnulib replacement function, then enable code below to make getcwd - more efficient and robust. */ -#if defined HAVE_OPENAT || defined GNULIB_OPENAT + gnulib replacement function with a native fdopendir, then enable + code below to make getcwd more efficient and robust. */ +#if defined HAVE_OPENAT || (defined GNULIB_OPENAT && defined HAVE_FDOPENDIR) # define HAVE_OPENAT_SUPPORT 1 #else # define HAVE_OPENAT_SUPPORT 0 -- 1.7.11.7