diff options
author | "Steven J. Hill" <sjhill@realitydiluted.com> | 2006-02-28 03:18:23 +0000 |
---|---|---|
committer | "Steven J. Hill" <sjhill@realitydiluted.com> | 2006-02-28 03:18:23 +0000 |
commit | 675d62ac876ffe4719580d45b8c9469934ccf6d7 (patch) | |
tree | e666bd4a1d816842c070e4928715d66b82655fc2 /libc/sysdeps/linux/common/getdirname.c | |
parent | fd666fca933f7241ff75d06ff36c9282fd443335 (diff) | |
download | uClibc-alpine-675d62ac876ffe4719580d45b8c9469934ccf6d7.tar.bz2 uClibc-alpine-675d62ac876ffe4719580d45b8c9469934ccf6d7.tar.xz |
Merge from trunk.
Diffstat (limited to 'libc/sysdeps/linux/common/getdirname.c')
-rw-r--r-- | libc/sysdeps/linux/common/getdirname.c | 30 |
1 files changed, 20 insertions, 10 deletions
diff --git a/libc/sysdeps/linux/common/getdirname.c b/libc/sysdeps/linux/common/getdirname.c index a4285322b..e196d1bd9 100644 --- a/libc/sysdeps/linux/common/getdirname.c +++ b/libc/sysdeps/linux/common/getdirname.c @@ -17,14 +17,23 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define getcwd __getcwd - #include <features.h> + +#ifdef __USE_GNU #include <unistd.h> #include <sys/stat.h> #include <stdlib.h> #include <string.h> +libc_hidden_proto(strdup) +libc_hidden_proto(getcwd) +libc_hidden_proto(getenv) +#ifdef __UCLIBC_HAS_LFS__ +libc_hidden_proto(stat64) +#else +libc_hidden_proto(stat) +#endif + /* Return a malloc'd string containing the current directory name. If the environment variable `PWD' is set, and its value is correct, that value is used. */ @@ -33,25 +42,26 @@ char * get_current_dir_name (void) { char *pwd; -#if defined __UCLIBC_HAS_LFS__ +#ifdef __UCLIBC_HAS_LFS__ struct stat64 dotstat, pwdstat; #else struct stat dotstat, pwdstat; #endif - pwd = __getenv ("PWD"); + pwd = getenv ("PWD"); if (pwd != NULL -#if defined __UCLIBC_HAS_LFS__ - && __stat64 (".", &dotstat) == 0 - && __stat64 (pwd, &pwdstat) == 0 +#ifdef __UCLIBC_HAS_LFS__ + && stat64 (".", &dotstat) == 0 + && stat64 (pwd, &pwdstat) == 0 #else - && __stat (".", &dotstat) == 0 - && __stat (pwd, &pwdstat) == 0 + && stat (".", &dotstat) == 0 + && stat (pwd, &pwdstat) == 0 #endif && pwdstat.st_dev == dotstat.st_dev && pwdstat.st_ino == dotstat.st_ino) /* The PWD value is correct. Use it. */ - return __strdup (pwd); + return strdup (pwd); return getcwd ((char *) NULL, 0); } +#endif |