summaryrefslogtreecommitdiff
path: root/lib/getcwd.c
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>2003-03-07 10:13:55 +0000
committerJim Meyering <jim@meyering.net>2003-03-07 10:13:55 +0000
commit5635524114369f5f1164859fd80327fbd943c734 (patch)
tree23a79ec4fd0b3075af635385566d60aa9fb7bd33 /lib/getcwd.c
parent5fb9e06a4a678c8241d219f79c265a7b24dcfdf0 (diff)
downloadcoreutils-5635524114369f5f1164859fd80327fbd943c734.tar.xz
#undef getcwd only after *all* included header files.
Declare getcwd unconditionally.
Diffstat (limited to 'lib/getcwd.c')
-rw-r--r--lib/getcwd.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/getcwd.c b/lib/getcwd.c
index e3a73f0ce..2968a6e98 100644
--- a/lib/getcwd.c
+++ b/lib/getcwd.c
@@ -19,10 +19,6 @@
#include <config.h>
-/* Undefine getcwd here so any prototype is not redefined to be a
- prototype for rpl_getcwd. */
-#undef getcwd
-
#include <stdlib.h>
#include <string.h>
@@ -43,6 +39,14 @@ extern int errno;
#define MAX_SAFE_LEN (PATH_MAX - 1 - KLUDGE_POSIX_NAME_MAX - 1)
+/* Undefine getcwd here, as near the use as possible, in case any
+ of the files included above define it to rpl_getcwd. */
+#undef getcwd
+
+/* Any declaration of getcwd from headers included above has
+ been changed to a declaration of rpl_getcwd. Declare it here. */
+extern char *getcwd (char *buf, size_t size);
+
/* This is a wrapper for getcwd.
Some implementations (at least GNU libc 2.3.1 + linux-2.4.20) return
non-NULL for a working directory name longer than PATH_MAX, yet the