From 22b69ec12b971647db99de0100e4f4ccb7d585d4 Mon Sep 17 00:00:00 2001 From: Alan Modra Date: Thu, 15 Nov 2007 05:20:30 +0000 Subject: PR 5328 * opncls.c (separate_debug_file_exists): Use fopen/fread rather than open/read and open in binary mode. --- bfd/opncls.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'bfd/opncls.c') diff --git a/bfd/opncls.c b/bfd/opncls.c index 1ea05575ca..47fef7036a 100644 --- a/bfd/opncls.c +++ b/bfd/opncls.c @@ -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; } -- cgit v1.2.1