From: Nick Clifton Date: Tue, 25 Nov 2008 08:48:49 +0000 (+0000) Subject: PR7044 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=20359e080aabfd078512ec67d7fc0a8f416aac17;p=binutils-gdb.git PR7044 * dlltool.c (run): Use formatting string to avoid compile time warning. (gen_exp_file): Check return value from fread. * windmc.c (main): Check return value from fread. --- diff --git a/binutils/ChangeLog b/binutils/ChangeLog index 3766c5187ef..c817fc9a9df 100644 --- a/binutils/ChangeLog +++ b/binutils/ChangeLog @@ -1,3 +1,11 @@ +2008-11-25 Nick Clifton + + PR7044 + * dlltool.c (run): Use formatting string to avoid compile time + warning. + (gen_exp_file): Check return value from fread. + * windmc.c (main): Check return value from fread. + 2008-11-21 Sterling Augustine * MAINTAINERS: Take over from Bob Wilson as Xtensa maintainer. diff --git a/binutils/dlltool.c b/binutils/dlltool.c index a19400d8449..89508f32ae9 100644 --- a/binutils/dlltool.c +++ b/binutils/dlltool.c @@ -1213,7 +1213,7 @@ run (const char *what, char *args) if (pid == -1) { - inform (strerror (errno)); + inform ("%s", strerror (errno)); fatal (errmsg_fmt, errmsg_arg); } @@ -1998,7 +1998,7 @@ gen_exp_file (void) bfd_vma addr; bfd_vma need[PAGE_SIZE]; bfd_vma page_addr; - int numbytes; + bfd_size_type numbytes; int num_entries; bfd_vma *copy; int j; @@ -2010,7 +2010,8 @@ gen_exp_file (void) numbytes = ftell (base_file); fseek (base_file, 0, SEEK_SET); copy = xmalloc (numbytes); - fread (copy, 1, numbytes, base_file); + if (fread (copy, 1, numbytes, base_file) < numbytes) + fatal (_("failed to read the number of entries from base file")); num_entries = numbytes / sizeof (bfd_vma); diff --git a/binutils/windmc.c b/binutils/windmc.c index 9392d657647..c7aa8f8e4e9 100644 --- a/binutils/windmc.c +++ b/binutils/windmc.c @@ -1144,7 +1144,7 @@ main (int argc, char **argv) unichar *u; rc_uint_type ul; char *buff; - long flen; + bfd_size_type flen; FILE *fp = fopen (input_filename, "rb"); if (!fp) @@ -1155,7 +1155,8 @@ main (int argc, char **argv) fseek (fp, 0, SEEK_SET); buff = malloc (flen + 3); memset (buff, 0, flen + 3); - fread (buff, 1, flen, fp); + if (fread (buff, 1, flen, fp) < flen) + fatal (_("unable to read contents of %s"), input_filename); fclose (fp); if (mcset_text_in_is_unicode != 1) {