From 2e18bd3453a1f225103bf8d75ef3c4493ad301c5 Mon Sep 17 00:00:00 2001 From: John Darrington Date: Fri, 20 Mar 2009 10:27:46 +0900 Subject: [PATCH] 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. --- Smake | 1 + src/data/make-file.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) 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) -- 2.30.2