diff --git a/Error-log b/Error-log index e38de8b..34d020e 100644 --- a/Error-log +++ b/Error-log @@ -107,3 +107,5 @@ October 1996. transcendental functions broken (sin, cos, tan, log) reported by jsc 8 Nov 96. Fixed by ??????????? + +Fixed up initial sizes for allocated filename buffers to be _POSIX_PATH_MAX. diff --git a/scsh/syscalls1.c b/scsh/syscalls1.c index c171bef..f4550ee 100644 --- a/scsh/syscalls1.c +++ b/scsh/syscalls1.c @@ -176,11 +176,20 @@ int set_cloexec(int fd, int val) ******************************************************************************* */ +/* Posix rules: If PATH_MAX is defined, it's the length of longest path. +** Otherwise, _POSIX_PATH_MAX = 255, and is a lower bound on said length. +*/ +#ifdef PATH_MAX +#define scsh_path_max (PATH_MAX) +#else +#define scsh_path_max (_POSIX_PATH_MAX) +#endif + /* Simple-minded POSIX version. */ int scheme_cwd(const char **dirp) { char *buf; - int size = 100; + int size = scsh_path_max + 1; /* +1 for terminating nul byte... */ buf = Malloc(char,size); if(!buf) goto lose;