summaryrefslogtreecommitdiff
path: root/lib/getcwd.c
diff options
context:
space:
mode:
authorPaul Eggert <eggert@cs.ucla.edu>2006-02-21 06:42:29 +0000
committerPaul Eggert <eggert@cs.ucla.edu>2006-02-21 06:42:29 +0000
commit6870eeeaff70a3a2721126a54ea2c25b956cc198 (patch)
tree7aed9becaf9649d49a3c553dd8dc8c174ba527c7 /lib/getcwd.c
parent362e0d7bd1fc54dcfac9e16a324c6da25852e4dd (diff)
downloadcoreutils-6870eeeaff70a3a2721126a54ea2c25b956cc198.tar.xz
(AT_FDCWD): Work around a bug in Solaris 9 and 10, where
AT_FDCWD exceeds INT_MAX.
Diffstat (limited to 'lib/getcwd.c')
-rw-r--r--lib/getcwd.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/lib/getcwd.c b/lib/getcwd.c
index ec1771b83..5bb9e4be1 100644
--- a/lib/getcwd.c
+++ b/lib/getcwd.c
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991,92,93,94,95,96,97,98,99,2004,2005 Free Software
+/* Copyright (C) 1991,92,93,94,95,96,97,98,99,2004,2005,2006 Free Software
Foundation, Inc.
This file is part of the GNU C Library.
@@ -74,6 +74,14 @@
#include <limits.h>
+/* Work around a bug in Solaris 9 and 10: AT_FDCWD is positive. Its
+ value exceeds INT_MAX, so its use as an int doesn't conform to the
+ C standard, and GCC and Sun C complain in some cases. */
+#if 0 < AT_FDCWD && AT_FDCWD == 0xffd19553
+# undef AT_FDCWD
+# define AT_FDCWD (-3041965)
+#endif
+
#ifdef ENAMETOOLONG
# define is_ENAMETOOLONG(x) ((x) == ENAMETOOLONG)
#else