summaryrefslogtreecommitdiff
path: root/lib/openat.h
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/openat.h
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/openat.h')
-rw-r--r--lib/openat.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/lib/openat.h b/lib/openat.h
index aa900c72e..017cf5cb0 100644
--- a/lib/openat.h
+++ b/lib/openat.h
@@ -35,10 +35,24 @@
# define ATTRIBUTE_NORETURN __attribute__ ((__noreturn__))
#endif
+/* 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 the bug
+ is present, undef AT_FDCWD here, so it can be redefined below. */
+#if 0 < AT_FDCWD && AT_FDCWD == 0xffd19553
+# undef AT_FDCWD
+#endif
+
+/* Use the same bit pattern as Solaris 9, but with the proper
+ signedness. The bit pattern is important, in case this actually is
+ Solaris with the above workaround. */
#ifndef AT_FDCWD
+# define AT_FDCWD (-3041965)
+#endif
+
/* Use the same values as Solaris 9. This shouldn't matter, but
there's no real reason to differ. */
-# define AT_FDCWD (-3041965)
+#ifndef AT_SYMLINK_NOFOLLOW
# define AT_SYMLINK_NOFOLLOW 4096
# define AT_REMOVEDIR 1
#endif