From: John Darrington Date: Fri, 20 Mar 2009 01:27:46 +0000 (+0900) Subject: Fix corrupted .sav files on w32 builds X-Git-Tag: v0.6.2-pre1~13 X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=2e18bd3453a1f225103bf8d75ef3c4493ad301c5;p=pspp-builds.git Fix corrupted .sav files on w32 builds Added the O_BINARY flag to the mode of files created with open, so that lines aren't appended with extraneous characters, thus corrupting .sav files. --- diff --git a/Smake b/Smake index a4664237..5a76b3c1 100644 --- a/Smake +++ b/Smake @@ -15,6 +15,7 @@ GNULIB_MODULES = \ environ \ exit \ fatal-signal \ + fcntl \ fpieee \ fprintf-posix \ full-read \ diff --git a/src/data/make-file.c b/src/data/make-file.c index 807adc50..2162741a 100644 --- a/src/data/make-file.c +++ b/src/data/make-file.c @@ -185,7 +185,7 @@ replace_file_start (const char *file_name, const char *mode, } /* Create file by that name. */ - fd = open (rf->tmp_name, O_WRONLY | O_CREAT | O_EXCL, permissions); + fd = open (rf->tmp_name, O_WRONLY | O_CREAT | O_EXCL | O_BINARY, permissions); if (fd >= 0) break; if (errno != EEXIST)