diff options
Diffstat (limited to 'otherlibs/unix/getcwd.c')
-rw-r--r-- | otherlibs/unix/getcwd.c | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/otherlibs/unix/getcwd.c b/otherlibs/unix/getcwd.c index 1c7b19f73..f57d68799 100644 --- a/otherlibs/unix/getcwd.c +++ b/otherlibs/unix/getcwd.c @@ -15,17 +15,23 @@ #include <alloc.h> #include "unixsupport.h" -#ifdef HAS_GETCWD - #ifndef _WIN32 #include <sys/param.h> +#endif + +#ifndef PATH_MAX +#ifdef MAXPATHLEN +#define PATH_MAN MAXPATHLEN #else -#define MAXPATHLEN 512 +#define PATH_MAX 512 +#endif #endif +#ifdef HAS_GETCWD + value unix_getcwd(value unit) /* ML */ { - char buff[MAXPATHLEN]; + char buff[PATH_MAX]; if (getcwd(buff, sizeof(buff)) == 0) uerror("getcwd", Nothing); return copy_string(buff); } @@ -33,11 +39,9 @@ value unix_getcwd(value unit) /* ML */ #else #ifdef HAS_GETWD -#include <sys/param.h> - value unix_getcwd(value unit) { - char buff[MAXPATHLEN]; + char buff[PATH_MAX]; if (getwd(buff) == 0) uerror("getcwd", copy_string(buff)); return copy_string(buff); } |