summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-04-25 18:42:16 +0000
committerJim Meyering <jim@meyering.net>2003-04-25 18:42:16 +0000
commit241673725eb8f01186a58b58ecab71268bdd3cd7 (patch)
tree93671351ac3a97c5902323604f85e0bdfce0d6d1
parentb45a0ca42e4bc649929e50b29675cf263cf2b733 (diff)
downloadcoreutils-241673725eb8f01186a58b58ecab71268bdd3cd7.tar.xz
(GL_FUNC_GETCWD_PATH_MAX): If PATH_MAX
is not defined, don't run the test, and don't use the wrapper. Otherwise, on the Hurd, it would take a long time to create and remove a hierarchy about 4000 levels deep. Based on a patch from Robert Millan.
-rw-r--r--m4/getcwd-path-max.m422
1 files changed, 10 insertions, 12 deletions
diff --git a/m4/getcwd-path-max.m4 b/m4/getcwd-path-max.m4
index 9069969b3..923a34c3f 100644
--- a/m4/getcwd-path-max.m4
+++ b/m4/getcwd-path-max.m4
@@ -1,4 +1,4 @@
-#serial 2
+#serial 3
# Check whether getcwd has the bug that it succeeds for a working directory
# longer than PATH_MAX, yet returns a truncated directory name.
# If so, arrange to compile the wrapper function.
@@ -44,23 +44,21 @@ AC_DEFUN([GL_FUNC_GETCWD_PATH_MAX],
# define INT_MAX TYPE_MAXIMUM (int)
#endif
-#ifndef PATH_MAX
-/* There might be a better way to handle this case, but note:
- - the value shouldn't be anywhere near INT_MAX, and
- - the value shouldn't be so big that the local declaration, below,
- blows the stack. */
-# define PATH_MAX 40000
-#endif
-
/* The length of this name must be 8. */
#define DIR_NAME "confdir3"
int
main ()
{
- /* The '9' comes from strlen (DIR_NAME) + 1. */
-#if INT_MAX - 9 <= PATH_MAX
- /* FIXME: Assuming there's a system for which this is true -- Hurd?,
+#ifndef PATH_MAX
+ /* The Hurd doesn't define this, so getcwd can't exhibit the bug --
+ at least not on a local file system. And if we were to start worrying
+ about remote file systems, we'd have to enable the wrapper function
+ all of the time, just to be safe. That's not worth the cost. */
+ exit (0);
+#elif INT_MAX - 9 <= PATH_MAX
+ /* The '9', above, comes from strlen (DIR_NAME) + 1. */
+ /* FIXME: Assuming there's a system for which this is true,
this should be done in a compile test. */
exit (0);
#else