[PATCH] Improve portability of clisp in the Hurd system

Flavio Cruz <[email protected]>
Newsgroups gmane.lisp.clisp.devel
Message-ID <20151231191726.GA12971@viriathus>
---

This allows clisp to be compiled in the Hurd by defining IS_EINVAL_EXTRA
and by removing the use of MAXPATHLEN.

diff -r d3f6e80fb705 modules/syscalls/calls.c
--- a/modules/syscalls/calls.c	Sun May 31 00:56:01 2015 -0400
+++ b/modules/syscalls/calls.c	Thu Dec 31 13:35:20 2015 -0500
@@ -5872,12 +5872,15 @@
   /* if DATEMSK is not set, set it to the clisp-supplied value */
   if (NULL == getenv("DATEMSK")) {
     with_string_0(physical_namestring(GLO(lib_dir)),GLO(pathname_encoding),ldz,{
-        char datemsk[MAXPATHLEN];
+        /* use enough space for datemsk */
+        const size_t datemsk_len = ldz_len + 1 + strlen("/syscalls/datemsk");
+        char *datemsk = malloc(sizeof(char) * datemsk_len);
         strcpy(datemsk,ldz);
         if (ldz[ldz_len-1] == '/')
           strcat(datemsk,"syscalls/datemsk");
         else strcat(datemsk,"/syscalls/datemsk");
         setenv("DATEMSK",datemsk,0);
+        free(datemsk);
       });
   }
 }
diff -r d3f6e80fb705 src/stream.d
--- a/src/stream.d	Sun May 31 00:56:01 2015 -0400
+++ b/src/stream.d	Thu Dec 31 13:35:20 2015 -0500
@@ -3484,6 +3484,8 @@
   #define IS_EINVAL_EXTRA  ((errno==EOPNOTSUPP)||(errno==ENOTSUP)||(errno==ENODEV))
 #elif defined(UNIX_SUNOS5)
   #define IS_EINVAL_EXTRA  ((errno==ENXIO))
+#elif defined(UNIX_HURD)
+  #define IS_EINVAL_EXTRA  ((errno==EOPNOTSUPP)||(errno==EMIG_BAD_ID))
 #else
   #define IS_EINVAL_EXTRA  0
 #endif

------------------------------------------------------------------------------
_______________________________________________
clisp-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/clisp-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.