build: Don't include <config.h> in native programs when cross-compiling.
[bpt/guile.git] / libguile / objcodes.c
index 004dd61..e315f3e 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
@@ -220,7 +220,9 @@ make_objcode_from_file (int fd)
         int errno_save = errno;
         (void) close (fd);
         errno = errno_save;
-        SCM_SYSERROR;
+        if (errno)
+          SCM_SYSERROR;
+        scm_misc_error (FUNC_NAME, "file truncated while reading", SCM_EOL);
       }
 
     (void) close (fd);
@@ -363,7 +365,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;