From: Jim Meyering Date: Fri, 7 Mar 2003 10:13:55 +0000 (+0000) Subject: #undef getcwd only after *all* included header files. X-Git-Tag: v4.5.10~105 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=5635524114369f5f1164859fd80327fbd943c734;p=thirdparty%2Fcoreutils.git #undef getcwd only after *all* included header files. Declare getcwd unconditionally. --- diff --git a/lib/getcwd.c b/lib/getcwd.c index e3a73f0ce3..2968a6e980 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