See the attached patch.

--
Pietro Cerutti
I have pledged to give 10% of income to effective charities
and invite you to join me - https://givingwhatwecan.org
>From 9659dacfc2664a9279b8ac249c726c1780d54008 Mon Sep 17 00:00:00 2001
From: Pietro Cerutti <g...@gahr.ch>
Date: Mon, 28 Oct 2024 15:24:28 +0000
Subject: [PATCH] Unwrap the string when calling C_do_readlink

When calling C_do_readlink, the buffer argoment was being passed as a
scheme string instead of as the underlying C string.
---
 posixunix.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/posixunix.scm b/posixunix.scm
index 3e244c24..5734b38f 100644
--- a/posixunix.scm
+++ b/posixunix.scm
@@ -743,7 +743,7 @@ static int set_file_mtime(C_word filename, C_word atime, 
C_word mtime)
     (lambda (fname location)
       (let ((len (##core#inline
                   "C_do_readlink"
-                  (##sys#make-c-string fname location) buf)))
+                  (##sys#make-c-string fname location) (##sys#make-c-string 
buf location))))
         (if (fx< len 0)
             (posix-error #:file-error location "cannot read symbolic link" 
fname)
             (substring buf 0 len))))))
-- 
2.47.0

Reply via email to