]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
PR 5328
authorAlan Modra <amodra@gmail.com>
Thu, 15 Nov 2007 05:20:30 +0000 (05:20 +0000)
committerAlan Modra <amodra@gmail.com>
Thu, 15 Nov 2007 05:20:30 +0000 (05:20 +0000)
* opncls.c (separate_debug_file_exists): Use fopen/fread
rather than open/read and open in binary mode.

bfd/ChangeLog
bfd/opncls.c

index ca4f83fcda979ae0759b984128b8de6f1f718dcd..a5b79ed786ed78b1d77ba0758e09b7cd0922bf2f 100644 (file)
@@ -1,3 +1,9 @@
+2007-11-15  Alan Modra  <amodra@bigpond.net.au>
+
+       PR 5328
+       * opncls.c (separate_debug_file_exists): Use fopen/fread
+       rather than open/read and open in binary mode.
+
 2007-11-14  Richard Sandiford  <richard@codesourcery.com>
 
        * elfxx-mips.c (mips_got_page_range): New structure.
        (read_rangelist): Change interface to accept a callback and data to
        allow caller to select the action peformed on a new range list read.
        (scan_unit_for_symbols): Use new interface of read_rangelist.
-       (parse_comp_unit): Create an arange set for each new comp unit.  Use new
-       interface of read_rangelist.  Replace call to arange_add with that to
-       dwarf2_comp_unit_arange_add.
+       (parse_comp_unit): Create an arange set for each new comp unit.
+       Use new interface of read_rangelist.  Replace call to arange_add
+       with that to dwarf2_comp_unit_arange_add.
        (comp_unit_contains_address): Replace sequential search with a call to
        arange_set_lookup_address, which can handles large set efficiently.
        (stash_copy_local_aranges, stash_maybe_enable_arange_set,
index 1ea05575ca59ed7c11babc531596f746331c7169..47fef7036a22093a301d3ecc2a5ee0c13548653c 100644 (file)
@@ -1175,19 +1175,19 @@ separate_debug_file_exists (const char *name, const unsigned long crc)
 {
   static unsigned char buffer [8 * 1024];
   unsigned long file_crc = 0;
-  int fd;
+  FILE *f;
   bfd_size_type count;
 
   BFD_ASSERT (name);
 
-  fd = open (name, O_RDONLY);
-  if (fd < 0)
+  f = real_fopen (name, FOPEN_RB);
+  if (f == NULL)
     return FALSE;
 
-  while ((count = read (fd, buffer, sizeof (buffer))) > 0)
+  while ((count = fread (buffer, 1, sizeof (buffer), f)) > 0)
     file_crc = bfd_calc_gnu_debuglink_crc32 (file_crc, buffer, count);
 
-  close (fd);
+  fclose (f);
 
   return crc == file_crc;
 }