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.
This commit is contained in:
Nick Clifton 2008-04-28 08:30:23 +00:00
parent 03ffc2d0a6
commit 417ed8af83
7 changed files with 24 additions and 23 deletions

View 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.

View File

@ -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 *

View 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

View 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;

View File

@ -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 *);

View File

@ -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

View File

@ -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;