[PATCH] Improve support for Hurd: define IS_EINVAL_EXTRA and avoid using MAXPATHLEN

Flavio Cruz <[email protected]>
Newsgroups gmane.lisp.clisp.devel
Message-ID <20170607052743.GA2254@debian>
diff -r 2b929ec66611 -r a93e57b79b04 modules/syscalls/calls.c
--- a/modules/syscalls/calls.c	Fri Jun 02 19:05:29 2017 +0200
+++ b/modules/syscalls/calls.c	Wed Jun 07 01:17:30 2017 -0400
@@ -5877,12 +5877,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 2b929ec66611 -r a93e57b79b04 src/stream.d
--- a/src/stream.d	Fri Jun 02 19:05:29 2017 +0200
+++ b/src/stream.d	Wed Jun 07 01:17:30 2017 -0400
@@ -3501,6 +3501,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


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
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.