getcwd: don't fail in a deep directory on a system without openat
authorJim Meyering <meyering@redhat.com>
Mon, 19 Sep 2011 07:48:35 +0000 (09:48 +0200)
committerJim Meyering <meyering@redhat.com>
Mon, 19 Sep 2011 14:42:10 +0000 (16:42 +0200)
commitf6fe351fc534ae1ccbebb9c61e68771e7ae99c97
tree6e4fedfbf658818623367c9c2413781c1ed440ea
parent79754ee9ef6e7ad67c023bb211e29a8a0204878d
getcwd: don't fail in a deep directory on a system without openat

Before this change, getcwd would fail when called from a directory
of depth PATH_MAX / 3 or greater.  That was due to the fact that
the non-openat implementation used "..", "../..", "../../..", etc.
to access ancestor directories.  With too many, that string would
be longer than PATH_MAX.
* lib/getcwd.c (HAVE_OPENAT_SUPPORT): Define also when we are
using gnulib's openat replacement.
* m4/openat.m4: Set GNULIB_OPENAT, so getcwd.c knows when
we're using the replacement function.
ChangeLog
lib/getcwd.c
m4/openat.m4