From bd24844d02c2add6a689c2963d35b9f9bb216147 Mon Sep 17 00:00:00 2001 From: Eric Blake Date: Mon, 7 Sep 2009 05:51:20 -0600 Subject: [PATCH] getcwd: minor cleanups * lib/getcwd.c (AT_FDCWD): Delete; rely on instead. (is_ENAMETOOLONG): Delete; ENAMETOOLONG is portable. Signed-off-by: Eric Blake --- ChangeLog | 4 ++++ lib/getcwd.c | 16 +--------------- 2 files changed, 5 insertions(+), 15 deletions(-) diff --git a/ChangeLog b/ChangeLog index f7ac99c4e7..771a9a919f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2009-09-07 Eric Blake + getcwd: minor cleanups + * lib/getcwd.c (AT_FDCWD): Delete; rely on instead. + (is_ENAMETOOLONG): Delete; ENAMETOOLONG is portable. + openat: provide more convenience names * modules/faccessat (configure.ac): Add C witness. * lib/unistd.in.h (readlinkat): Fix typo. diff --git a/lib/getcwd.c b/lib/getcwd.c index 2da1aeef28..6658ed58c0 100644 --- a/lib/getcwd.c +++ b/lib/getcwd.c @@ -59,20 +59,6 @@ #include -/* 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 -# define is_ENAMETOOLONG(x) 0 -#endif - #ifndef MAX # define MAX(a, b) ((a) < (b) ? (b) : (a)) #endif @@ -164,7 +150,7 @@ __getcwd (char *buf, size_t size) # undef getcwd dir = getcwd (buf, size); - if (dir || (errno != ERANGE && !is_ENAMETOOLONG (errno) && errno != ENOENT)) + if (dir || (errno != ERANGE && errno != ENAMETOOLONG && errno != ENOENT)) return dir; #endif -- 2.30.2