The cwd code nows starts out with the filename buffer initialised

to length _POSIX_PATH_MAX.
This commit is contained in:
shivers 1996-11-11 20:56:52 +00:00
parent 1cdcaaee53
commit faa08159d0
2 changed files with 12 additions and 1 deletions

View File

@ -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.

View File

@ -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;