PR binutils/6449
authorNick Clifton <nickc@redhat.com>
Mon, 28 Apr 2008 08:30:23 +0000 (08:30 +0000)
committerNick Clifton <nickc@redhat.com>
Mon, 28 Apr 2008 08:30:23 +0000 (08:30 +0000)
                * objdump.c (slurp_file): Open the file in binary mode.
                * ar.c: Remove conditional definition of O_BINARY.
                * bin2.c: Likewise.
                * rename.c: Likewise.
                * strings.c: Likewise.
                * sysdep.h: Add conditional definition of O_BINARY.

binutils/ChangeLog
binutils/ar.c
binutils/bin2c.c
binutils/objdump.c
binutils/rename.c
binutils/strings.c
binutils/sysdep.h

index 6ef5a35..b3caac3 100644 (file)
@@ -1,3 +1,14 @@
+2008-04-28  M Thomas  <mthomas@rhrk.uni-kl.de>
+           Nick Clifton  <nickc@redhat.com>
+
+       PR binutils/6449
+       * objdump.c (slurp_file): Open the file in binary mode.
+       * ar.c: Remove conditional definition of O_BINARY.
+       * bin2.c: Likewise.
+       * rename.c: Likewise.
+       * strings.c: Likewise.
+       * sysdep.h: Add conditional definition of O_BINARY.
+
 2008-04-23  Paolo Bonzini  <bonzini@gnu.org>
 
        * aclocal.m4: Regenerate.
index 71f4d73..f493221 100644 (file)
 #define EXT_NAME_LEN 6         /* Ditto for *NIX.  */
 #endif
 
-/* We need to open files in binary modes on system where that makes a
-   difference.  */
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
 /* Kludge declaration from BFD!  This is ugly!  FIXME!  XXX  */
 
 struct ar_hdr *
index 0eeff35..b3138e1 100644 (file)
@@ -1,5 +1,5 @@
 /* bin2c.c -- dump binary file in hex format
-   Copyright 2007 Free Software Foundation, Inc.
+   Copyright 2007, 2008 Free Software Foundation, Inc.
 
    This file is part of GNU Binutils.
 
@@ -22,9 +22,8 @@
 #include "bfd.h"
 #include "bucomm.h"
 
-#if !defined O_BINARY && defined _O_BINARY
+#if !defined O_TEXT && defined _O_TEXT
   /* For MSC-compatible compilers.  */
-# define O_BINARY _O_BINARY
 # define O_TEXT _O_TEXT
 #endif
 
index b348025..5a86250 100644 (file)
@@ -964,7 +964,7 @@ static struct print_file_list *print_files;
 
 #define SHOW_PRECEDING_CONTEXT_LINES (5)
 
-/* Read a complete file into memory. */
+/* Read a complete file into memory.  */
 
 static const char *
 slurp_file (const char *fn, size_t *size)
@@ -975,7 +975,7 @@ slurp_file (const char *fn, size_t *size)
 #endif
   const char *map;
   struct stat st;
-  int fd = open (fn, O_RDONLY);
+  int fd = open (fn, O_RDONLY | O_BINARY);
 
   if (fd < 0)
     return NULL;
index 6ae4d29..367ed1f 100644 (file)
 #endif /* HAVE_UTIMES */
 #endif /* ! HAVE_GOOD_UTIME_H */
 
-/* We need to open the file in binary modes on system where that makes
-   a difference.  */
-#ifndef O_BINARY
-#define O_BINARY 0
-#endif
-
 #if ! defined (_WIN32) || defined (__CYGWIN32__)
 static int simple_copy (const char *, const char *);
 
index 40b53b8..973045e 100644 (file)
 /* Some platforms need to put stdin into binary mode, to read
     binary files.  */
 #ifdef HAVE_SETMODE
-#ifndef O_BINARY
 #ifdef _O_BINARY
-#define O_BINARY _O_BINARY
 #define setmode _setmode
-#else
-#define O_BINARY 0
-#endif
 #endif
 #if O_BINARY
 #include <io.h>
-#define SET_BINARY(f) do { if (!isatty (f)) setmode (f,O_BINARY); } while (0)
+#define SET_BINARY(f) do { if (!isatty (f)) setmode (f, O_BINARY); } while (0)
 #endif
 #endif
 
index 0d7e250..e6a89a4 100644 (file)
 #include "fopen-same.h"
 #endif
 
+#ifndef O_BINARY
+#ifdef  _O_BINARY
+#define O_BINARY _O_BINARY
+#else
+#define O_BINARY 0
+#endif
+#endif
+
 #include <errno.h>
 #ifndef errno
 extern int errno;