chicken-hackers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

patch for chicken on 64-bit windows (msys and mingw-w64)


From: Jani Hakala
Subject: patch for chicken on 64-bit windows (msys and mingw-w64)
Date: Wed, 25 Aug 2021 21:29:31 +0300
User-agent: Gnus/5.130013 (Ma Gnus v0.13) Emacs/27 (gnu/linux)

Hi,

This patch seems to fix the problem with chicken-install when

    chicken-install -defaults ./setup.defaults -update-db

appears to hang when installing chicken.

>From e0fb00c8272f538f8d468564dc7a5ff2e3f76e5f Mon Sep 17 00:00:00 2001
From: Jani Hakala <jahakala@iki.fi>
Date: Wed, 25 Aug 2021 19:49:17 +0300
Subject: [PATCH] Fix handle type

Use intptr_t instead of int for handle returned by _findfirst in the
opendir() implementation in file.scm.

Without this fix, _findnext causes a segmentation fault on
windows 10 (64bit, msys2, gcc 10.3.0) if "chicken-install -update-db"
is started by gdb.
---
 file.scm | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/file.scm b/file.scm
index 18ce00f1..ca241854 100644
--- a/file.scm
+++ b/file.scm
@@ -77,7 +77,7 @@ struct dirent
 typedef struct
 {
     struct _finddata_t  fdata;
-    int                 handle;
+    intptr_t            handle;
     struct dirent       current;
 } DIR;
 
-- 
2.30.2


Since mingw-w64 provides implementations for opendir and readdir, it
might be better to use those i.e.

-#if !defined(_WIN32) || defined(__CYGWIN__)
+#if !defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__)
 # include <sys/types.h>
 # include <dirent.h>
 #else

This would probably need more testing.

Jani

reply via email to

[Prev in Thread] Current Thread [Next in Thread]