summaryrefslogtreecommitdiff
path: root/lib/getcwd.c
diff options
context:
space:
mode:
authorBruno Haible <bruno@clisp.org>2011-08-05 03:01:01 +0200
committerBruno Haible <bruno@clisp.org>2011-08-05 03:01:01 +0200
commit6310fc6d3e3f086e825cbd6f53950fbdc1ac7b42 (patch)
tree051f5bba7dc9b6acc19e8e2507ab3a091054a618 /lib/getcwd.c
parent7f494c7d725db4a7f3abdef09d4070725487da67 (diff)
downloadgnulib-6310fc6d3e3f086e825cbd6f53950fbdc1ac7b42.tar.gz
pathmax: Leave PATH_MAX undefined on the Hurd, and a constant otherwise.
* lib/pathmax.h (PATH_MAX): Leave it undefined on GNU/Hurd. * lib/chdir-long.h: Include pathmax.h. * lib/clean-temp.c (PATH_MAX): Remove code that is done by pathmax.h. * lib/getcwd.c: Include pathmax.h instead of <limits.h>. (PATH_MAX): Remove code that is done by pathmax.h. * lib/canonicalize.c (PATH_MAX): Provide a fallback value. * lib/tmpfile.c: Add a comment. * m4/pathmax.m4 (gl_PATHMAX): Don't test for pathconf. * modules/chdir-long (Depends-on): Add pathmax. * modules/getcwd (Depends-on): Add pathmax. * tests/test-getcwd.c (test_abort_bug): Avoid syntax error when PATH_MAX is not defined. * doc/posix-headers/limits.texi: Mention the pathmax module. * NEWS: Mention the change.
Diffstat (limited to 'lib/getcwd.c')
-rw-r--r--lib/getcwd.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/lib/getcwd.c b/lib/getcwd.c
index e52af1856f..f09fc3e8dd 100644
--- a/lib/getcwd.c
+++ b/lib/getcwd.c
@@ -57,8 +57,6 @@
# endif
#endif
-#include <limits.h>
-
#ifndef MAX
# define MAX(a, b) ((a) < (b) ? (b) : (a))
#endif
@@ -66,12 +64,12 @@
# define MIN(a, b) ((a) < (b) ? (a) : (b))
#endif
+#include "pathmax.h"
+
+/* In this file, PATH_MAX only serves as a threshold for choosing among two
+ algorithms. */
#ifndef PATH_MAX
-# ifdef MAXPATHLEN
-# define PATH_MAX MAXPATHLEN
-# else
-# define PATH_MAX 1024
-# endif
+# define PATH_MAX 8192
#endif
#if D_INO_IN_DIRENT