summaryrefslogtreecommitdiffstats
path: root/otherlibs/unix/readlink.c
diff options
context:
space:
mode:
Diffstat (limited to 'otherlibs/unix/readlink.c')
-rw-r--r--otherlibs/unix/readlink.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/otherlibs/unix/readlink.c b/otherlibs/unix/readlink.c
index 885b6243a..2e41cbce8 100644
--- a/otherlibs/unix/readlink.c
+++ b/otherlibs/unix/readlink.c
@@ -19,9 +19,17 @@
#include <sys/param.h>
#include "unixsupport.h"
+#ifndef PATH_MAX
+#ifdef MAXPATHLEN
+#define PATH_MAN MAXPATHLEN
+#else
+#define PATH_MAX 512
+#endif
+#endif
+
value unix_readlink(value path) /* ML */
{
- char buffer[MAXPATHLEN];
+ char buffer[PATH_MAX];
int len;
len = readlink(String_val(path), buffer, sizeof(buffer) - 1);
if (len == -1) uerror("readlink", path);