diff options
Diffstat (limited to 'sysdeps/posix')
-rw-r--r-- | sysdeps/posix/getcwd.c | 29 | ||||
-rw-r--r-- | sysdeps/posix/libc_fatal.c | 1 |
2 files changed, 8 insertions, 22 deletions
diff --git a/sysdeps/posix/getcwd.c b/sysdeps/posix/getcwd.c index 05f626f869..af858a2643 100644 --- a/sysdeps/posix/getcwd.c +++ b/sysdeps/posix/getcwd.c @@ -180,15 +180,18 @@ extern char *alloca (); #define __lstat stat #endif -/* Get the canonical absolute name of the named directory, and put it in SIZE +#ifndef _LIBC +#define __getcwd getcwd +#endif + +/* Get the pathname of the current working directory, and put it in SIZE bytes of BUF. Returns NULL if the directory couldn't be determined or SIZE was too small. If successful, returns BUF. In GNU, if BUF is NULL, an array is allocated with `malloc'; the array is SIZE bytes long, unless SIZE <= 0, in which case it is as big as necessary. */ char * -__canonicalize_directory_name_internal (thisdir, buf, size) - const char *thisdir; +__getcwd (buf, size) char *buf; size_t size; { @@ -227,7 +230,7 @@ __canonicalize_directory_name_internal (thisdir, buf, size) pathp = path + size; *--pathp = '\0'; - if (__lstat (thisdir, &st) < 0) + if (__lstat (".", &st) < 0) return NULL; thisdev = st.st_dev; thisino = st.st_ino; @@ -366,24 +369,6 @@ __canonicalize_directory_name_internal (thisdir, buf, size) free ((__ptr_t) dotlist); return NULL; } - -/* Get the pathname of the current working directory, and put it in SIZE - bytes of BUF. Returns NULL if the directory couldn't be determined or - SIZE was too small. If successful, returns BUF. In GNU, if BUF is - NULL, an array is allocated with `malloc'; the array is SIZE bytes long, - unless SIZE <= 0, in which case it is as big as necessary. */ - -#ifndef _LIBC -#define __getcwd getcwd -#endif - -char * -__getcwd (buf, size) - char *buf; - size_t size; -{ - return __canonicalize_directory_name_internal (".", buf, size); -} #ifdef _LIBC weak_alias (__getcwd, getcwd) diff --git a/sysdeps/posix/libc_fatal.c b/sysdeps/posix/libc_fatal.c index 5539516733..22f6c4cd43 100644 --- a/sysdeps/posix/libc_fatal.c +++ b/sysdeps/posix/libc_fatal.c @@ -21,6 +21,7 @@ Cambridge, MA 02139, USA. */ #include <unistd.h> #include <errno.h> #include <sysdep.h> +#include <string.h> #ifdef FATAL_PREPARE_INCLUDE #include FATAL_PREPARE_INCLUDE |