summaryrefslogtreecommitdiff
path: root/libc/sysdeps/linux/common/getcwd.c
diff options
context:
space:
mode:
Diffstat (limited to 'libc/sysdeps/linux/common/getcwd.c')
-rw-r--r--libc/sysdeps/linux/common/getcwd.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/libc/sysdeps/linux/common/getcwd.c b/libc/sysdeps/linux/common/getcwd.c
index a9042c76b..165ea317e 100644
--- a/libc/sysdeps/linux/common/getcwd.c
+++ b/libc/sysdeps/linux/common/getcwd.c
@@ -12,9 +12,11 @@
#include <dirent.h>
#include <string.h>
#include <unistd.h>
+#include <sys/param.h>
#include <sys/syscall.h>
libc_hidden_proto(getcwd)
+libc_hidden_proto(getpagesize)
libc_hidden_proto(strcat)
libc_hidden_proto(strcpy)
@@ -182,7 +184,7 @@ char *getcwd(char *buf, size_t size)
__set_errno(EINVAL);
return NULL;
}
- alloc_size = PATH_MAX;
+ alloc_size = MAX (PATH_MAX, getpagesize ());
}
path=buf;
if (buf == NULL) {