diff --git a/src/fileio.c b/src/fileio.c index dfab3de..69aa3f6 100644 --- a/src/fileio.c +++ b/src/fileio.c @@ -1929,7 +1929,7 @@ permissions. */) } #else /* not WINDOWSNT */ immediate_quit = 1; - ifd = emacs_open (SSDATA (encoded_file), O_RDONLY, 0); + ifd = emacs_open (SSDATA (encoded_file), O_RDONLY | O_BINARY, 0); immediate_quit = 0; if (ifd < 0) @@ -1963,15 +1963,15 @@ permissions. */) new_mask = S_IREAD | S_IWRITE; #endif - ofd = emacs_open (SSDATA (encoded_newname), O_WRONLY | O_CREAT | O_EXCL, - new_mask); + ofd = emacs_open (SSDATA (encoded_newname), + O_WRONLY | O_CREAT | O_EXCL | O_BINARY, new_mask); if (ofd < 0 && errno == EEXIST) { if (NILP (ok_if_already_exists) || INTEGERP (ok_if_already_exists)) barf_or_query_if_file_exists (newname, true, "copy to it", INTEGERP (ok_if_already_exists), false); already_exists = true; - ofd = emacs_open (SSDATA (encoded_newname), O_WRONLY, 0); + ofd = emacs_open (SSDATA (encoded_newname), O_WRONLY | O_BINARY, 0); } if (ofd < 0) report_file_error ("Opening output file", newname);