>From edff979befa47a03a7d2686fab498c9e77008a08 Mon Sep 17 00:00:00 2001 From: Mario Domenech Goulart Date: Mon, 22 Aug 2022 22:20:04 +0200 Subject: [PATCH] Use C_MAX_PATH as maximum buffer size for getcwd Basically replace the hardcoded value (1024) with the value of C_MAX_PATH for the maximum buffer size for getcwd. --- library.scm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/library.scm b/library.scm index a8103a47..6726bed3 100644 --- a/library.scm +++ b/library.scm @@ -5883,7 +5883,7 @@ EOF #> #define C_chdir(str) C_fix(chdir(C_c_string(str))) -#define C_curdir(buf) (getcwd(C_c_string(buf), 1024) ? C_fix(strlen(C_c_string(buf))) : C_SCHEME_FALSE) +#define C_curdir(buf) (getcwd(C_c_string(buf), C_MAX_PATH) ? C_fix(strlen(C_c_string(buf))) : C_SCHEME_FALSE) #define C_getenventry(i) (environ[ i ]) #ifdef HAVE_CRT_EXTERNS_H @@ -5949,7 +5949,7 @@ static C_word C_fcall C_setenv(C_word x, C_word y) { (define current-directory (getter-with-setter (lambda () - (let* ((buffer (make-string 1024)) + (let* ((buffer (make-string (foreign-value "C_MAX_PATH" size_t))) (len (##core#inline "C_curdir" buffer))) (unless ##sys#windows-platform ; FIXME need `cond-expand' here (##sys#update-errno)) -- 2.30.2