diff options
author | Nick Clifton <nickc@redhat.com> | 2008-04-28 08:30:23 +0000 |
---|---|---|
committer | Nick Clifton <nickc@redhat.com> | 2008-04-28 08:30:23 +0000 |
commit | 417ed8af836c10ff5c0cbcdc4c011f5024a7269b (patch) | |
tree | e8226b5010a9af926802fd3a80993c68c852c791 | |
parent | 03ffc2d0a62908f72e010495ebd7f5a7efe08e3f (diff) | |
download | gdb-417ed8af836c10ff5c0cbcdc4c011f5024a7269b.zip gdb-417ed8af836c10ff5c0cbcdc4c011f5024a7269b.tar.gz gdb-417ed8af836c10ff5c0cbcdc4c011f5024a7269b.tar.bz2 |
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.
-rw-r--r-- | binutils/ChangeLog | 11 | ||||
-rw-r--r-- | binutils/ar.c | 6 | ||||
-rw-r--r-- | binutils/bin2c.c | 5 | ||||
-rw-r--r-- | binutils/objdump.c | 4 | ||||
-rw-r--r-- | binutils/rename.c | 6 | ||||
-rw-r--r-- | binutils/strings.c | 7 | ||||
-rw-r--r-- | binutils/sysdep.h | 8 |
7 files changed, 24 insertions, 23 deletions
diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 6ef5a35..b3caac3 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -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. diff --git a/binutils/ar.c b/binutils/ar.c index 71f4d73..f493221 100644 --- a/binutils/ar.c +++ b/binutils/ar.c @@ -45,12 +45,6 @@ #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 * diff --git a/binutils/bin2c.c b/binutils/bin2c.c index 0eeff35..b3138e1 100644 --- a/binutils/bin2c.c +++ b/binutils/bin2c.c @@ -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 diff --git a/binutils/objdump.c b/binutils/objdump.c index b348025..5a86250 100644 --- a/binutils/objdump.c +++ b/binutils/objdump.c @@ -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; diff --git a/binutils/rename.c b/binutils/rename.c index 6ae4d29..367ed1f 100644 --- a/binutils/rename.c +++ b/binutils/rename.c @@ -32,12 +32,6 @@ #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 *); diff --git a/binutils/strings.c b/binutils/strings.c index 40b53b8..973045e 100644 --- a/binutils/strings.c +++ b/binutils/strings.c @@ -69,17 +69,12 @@ /* 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 diff --git a/binutils/sysdep.h b/binutils/sysdep.h index 0d7e250..e6a89a4 100644 --- a/binutils/sysdep.h +++ b/binutils/sysdep.h @@ -36,6 +36,14 @@ #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; |