From 7fb90fb89bbdf273ab7ab96517fe1b156cd7aee1 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sun, 8 May 2011 08:37:19 -0400 Subject: Fix Linux getcwd for long paths The getcwd syscall (so far?) can only handle path up to one page in size. There is no limit about directory hierarchy depth, though, and the POSIX getcwd is supposed to handle this. In that case fall back to the generic getcwd. Additionally, optimize the generic getcwd to use openat when possible to change the asymptotic performance from O(N^2) to O(n). --- include/sys/stat.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include/sys') diff --git a/include/sys/stat.h b/include/sys/stat.h index 66898b1760..e00df5381e 100644 --- a/include/sys/stat.h +++ b/include/sys/stat.h @@ -48,4 +48,6 @@ libc_hidden_proto (__fxstatat64) #define fstat64(fd, buf) __fxstat64 (_STAT_VER, fd, buf) #define fstat(fd, buf) __fxstat (_STAT_VER, fd, buf) #define __fstat(fd, buf) __fxstat (_STAT_VER, fd, buf) +#define __fstatat(dfd, fname, buf, flag) \ + __fxstatat (_STAT_VER, dfd, fname, buf, flag) #endif -- cgit 1.4.1