From 5635524114369f5f1164859fd80327fbd943c734 Mon Sep 17 00:00:00 2001 From: Jim Meyering Date: Fri, 7 Mar 2003 10:13:55 +0000 Subject: #undef getcwd only after *all* included header files. Declare getcwd unconditionally. --- lib/getcwd.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'lib/getcwd.c') 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 -/* Undefine getcwd here so any prototype is not redefined to be a - prototype for rpl_getcwd. */ -#undef getcwd - #include #include @@ -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 -- cgit v1.2.3-54-g00ecf