copy-file and load-objcode use O_BINARY
authorAndy Wingo <wingo@pobox.com>
Tue, 19 Feb 2013 21:36:22 +0000 (22:36 +0100)
committerAndy Wingo <wingo@pobox.com>
Tue, 19 Feb 2013 21:36:22 +0000 (22:36 +0100)
* libguile/filesys.c (scm_copy_file):
* libguile/objcodes.c (scm_load_objcode): Use O_BINARY.  Thanks to Eli
  Zaretskii for the patch.

libguile/filesys.c
libguile/objcodes.c

index 94d824e..2c4168e 100644 (file)
@@ -1095,7 +1095,7 @@ SCM_DEFINE (scm_copy_file, "copy-file", 2, 0, 0,
   c_newfile = scm_to_locale_string (newfile);
   scm_dynwind_free (c_newfile);
 
-  oldfd = open_or_open64 (c_oldfile, O_RDONLY);
+  oldfd = open_or_open64 (c_oldfile, O_RDONLY | O_BINARY);
   if (oldfd == -1)
     SCM_SYSERROR;
 
index 004dd61..a8515a7 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (C) 2001, 2009, 2010, 2011 Free Software Foundation, Inc.
+/* Copyright (C) 2001, 2009, 2010, 2011, 2013 Free Software Foundation, Inc.
  * 
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public License
@@ -363,7 +363,7 @@ SCM_DEFINE (scm_load_objcode, "load-objcode", 1, 0, 0,
   SCM_VALIDATE_STRING (1, file);
 
   c_file = scm_to_locale_string (file);
-  fd = open (c_file, O_RDONLY | O_CLOEXEC);
+  fd = open (c_file, O_RDONLY | O_BINARY | O_CLOEXEC);
   free (c_file);
   if (fd < 0) SCM_SYSERROR;