[Top][All Lists]

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

Re: Link failure on systems lacking mkstemp

From: Eli Zaretskii
Subject: Re: Link failure on systems lacking mkstemp
Date: Sat, 16 Aug 2014 17:49:10 +0300

> Date: Sat, 16 Aug 2014 14:42:54 +0300
> From: Eli Zaretskii <address@hidden>
> I think the solution is simply remove mkstemp.c from libguile/, and
> all its traces from the configury that causes its dependency to be
> added to libguile/Makefile.  Not sure how to do the latter, though.

Actually, there's one small change that's required for using Gnulib's
mkstemp: it opens the temporary file in the (default) text I/O mode,
while we need it in binary mode, because we use these temporary files
for writing *.go files.  Here's the proposed patch:

+++ libguile/filesys.c  2014-08-16 17:44:35.578125000 +0300
@@ -1479,6 +1479,14 @@ SCM_DEFINE (scm_mkstemp, "mkstemp!", 1, 
   SCM_SYSCALL (rv = mkstemp (c_tmpl));
   if (rv == -1)
+#ifdef __MINGW32__
+  /* Files created by this function are used for *.go files, so make
+     sure they use binary I/O, or else the produced *.go files will be
+     corrupted by end-of-line conversion and ^Z "software EOF"
+     misfeature.  Gnulib's 'mkstemp' uses the default text mode to
+     open the file .  */
+  _setmode (rv, _O_BINARY);
   scm_substring_move_x (scm_from_locale_string (c_tmpl),
                        SCM_INUM0, scm_string_length (tmpl),

reply via email to

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