From 6f7dc709ed7e403af224b0fbb91e9619629eb2ec Mon Sep 17 00:00:00 2001 From: "Peter S. Mazinger" Date: Sat, 14 Jan 2006 19:45:02 +0000 Subject: make DODEBUG=y happy, update sysdeps/common/* copyright --- libc/sysdeps/linux/common/getcwd.c | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'libc/sysdeps/linux/common/getcwd.c') diff --git a/libc/sysdeps/linux/common/getcwd.c b/libc/sysdeps/linux/common/getcwd.c index 63b195ec2..a9042c76b 100644 --- a/libc/sysdeps/linux/common/getcwd.c +++ b/libc/sysdeps/linux/common/getcwd.c @@ -11,8 +11,11 @@ #include #include #include +#include #include +libc_hidden_proto(getcwd) + libc_hidden_proto(strcat) libc_hidden_proto(strcpy) libc_hidden_proto(strncpy) @@ -24,7 +27,7 @@ libc_hidden_proto(stat) #ifdef __NR_getcwd -#define __NR___syscall_getcwd __NR_getcwd +# define __NR___syscall_getcwd __NR_getcwd static inline _syscall2(int, __syscall_getcwd, char *, buf, unsigned long, size); @@ -49,18 +52,18 @@ static char *search_dir(dev_t this_dev, ino_t this_ino, char *path_buf, int path int slen; struct stat st; -#ifdef FAST_DIR_SEARCH_POSSIBLE +# ifdef FAST_DIR_SEARCH_POSSIBLE /* The test is for ELKS lib 0.0.9, this should be fixed in the real kernel */ int slow_search = (sizeof(ino_t) != sizeof(d->d_ino)); -#endif +# endif if (stat(path_buf, &st) < 0) { goto oops; } -#ifdef FAST_DIR_SEARCH_POSSIBLE +# ifdef FAST_DIR_SEARCH_POSSIBLE if (this_dev != st.st_dev) slow_search = 1; -#endif +# endif slen = strlen(path_buf); ptr = path_buf + slen - 1; @@ -79,9 +82,9 @@ static char *search_dir(dev_t this_dev, ino_t this_ino, char *path_buf, int path } while ((d = readdir(dp)) != 0) { -#ifdef FAST_DIR_SEARCH_POSSIBLE +# ifdef FAST_DIR_SEARCH_POSSIBLE if (slow_search || this_ino == d->d_ino) { -#endif +# endif if (slen + strlen(d->d_name) > path_size) { goto oops; } @@ -92,9 +95,9 @@ static char *search_dir(dev_t this_dev, ino_t this_ino, char *path_buf, int path closedir(dp); return path_buf; } -#ifdef FAST_DIR_SEARCH_POSSIBLE +# ifdef FAST_DIR_SEARCH_POSSIBLE } -#endif +# endif } closedir(dp); @@ -166,7 +169,7 @@ int __syscall_getcwd(char * buf, unsigned long size) return len; } -#endif +#endif /* __NR_getcwd */ char *getcwd(char *buf, size_t size) { @@ -200,5 +203,4 @@ char *getcwd(char *buf, size_t size) free (path); return NULL; } -libc_hidden_proto(getcwd) libc_hidden_def(getcwd) -- cgit v1.2.3