From faa08159d04e0cf9da51ce90752a605ad1201a60 Mon Sep 17 00:00:00 2001 From: shivers Date: Mon, 11 Nov 1996 20:56:52 +0000 Subject: [PATCH] The cwd code nows starts out with the filename buffer initialised to length _POSIX_PATH_MAX. --- Error-log | 2 ++ scsh/syscalls1.c | 11 ++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) 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;