summaryrefslogtreecommitdiff
path: root/bfd/opncls.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@bigpond.net.au>2007-11-15 05:20:30 +0000
committerAlan Modra <amodra@bigpond.net.au>2007-11-15 05:20:30 +0000
commita629ee1c07e4918a18dc1f1f5a37b0c025fd6bfc (patch)
tree6f62b23f40a9a36d42329ee43bb84a28e3e51de5 /bfd/opncls.c
parentd9fc6db75144c2cef52aa9b744823cfec4aff9aa (diff)
downloadgdb-a629ee1c07e4918a18dc1f1f5a37b0c025fd6bfc.tar.gz
PR 5328
* opncls.c (separate_debug_file_exists): Use fopen/fread rather than open/read and open in binary mode.
Diffstat (limited to 'bfd/opncls.c')
-rw-r--r--bfd/opncls.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/bfd/opncls.c b/bfd/opncls.c
index 1ea05575ca5..47fef7036a2 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;
}