aboutsummaryrefslogtreecommitdiff
path: root/io/ftw.c
diff options
context:
space:
mode:
Diffstat (limited to 'io/ftw.c')
-rw-r--r--io/ftw.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/io/ftw.c b/io/ftw.c
index c53773d..f7e3365 100644
--- a/io/ftw.c
+++ b/io/ftw.c
@@ -462,7 +462,11 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors,
* sizeof (struct dir_data *));
memset (data.dirstreams, '\0', data.maxdir * sizeof (struct dir_data *));
+#ifdef PATH_MAX
data.dirbufsize = MAX (2 * strlen (dir), PATH_MAX);
+#else
+ data.dirbufsize = 2 * strlen (dir);
+#endif
data.dirbuf = (char *) malloc (data.dirbufsize);
if (data.dirbuf == NULL)
return -1;