summaryrefslogtreecommitdiff
path: root/binutils/ar.c
diff options
context:
space:
mode:
authorKazu Hirata <kazu@codesourcery.com>2007-01-25 15:40:22 +0000
committerKazu Hirata <kazu@codesourcery.com>2007-01-25 15:40:22 +0000
commitfeba7b767035504ff8dc6bea829e58c85e9c751a (patch)
tree4853d3454684a7fafe6c8d9552d61523f3fc3572 /binutils/ar.c
parentaf7cac5f279d6cb96c0ba02bf49e7393519acf47 (diff)
downloadbinutils-redhat-feba7b767035504ff8dc6bea829e58c85e9c751a.tar.gz
* ar.c (print_contents, extract_file): Cast the return value
of fwrite to size_t.
Diffstat (limited to 'binutils/ar.c')
-rw-r--r--binutils/ar.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/binutils/ar.c b/binutils/ar.c
index 115224221e..1fbacf9101 100644
--- a/binutils/ar.c
+++ b/binutils/ar.c
@@ -805,7 +805,11 @@ print_contents (bfd *abfd)
/* xgettext:c-format */
fatal (_("%s is not a valid archive"),
bfd_get_filename (bfd_my_archive (abfd)));
- if (fwrite (cbuf, 1, nread, stdout) != nread)
+
+ /* fwrite in mingw32 may return int instead of size_t. Cast the
+ return value to size_t to avoid comparison between signed and
+ unsigned values. */
+ if ((size_t) fwrite (cbuf, 1, nread, stdout) != nread)
fatal ("stdout: %s", strerror (errno));
ncopied += tocopy;
}
@@ -885,7 +889,11 @@ extract_file (bfd *abfd)
output_file = ostream;
}
- if (fwrite (cbuf, 1, nread, ostream) != nread)
+
+ /* fwrite in mingw32 may return int instead of size_t. Cast
+ the return value to size_t to avoid comparison between
+ signed and unsigned values. */
+ if ((size_t) fwrite (cbuf, 1, nread, ostream) != nread)
fatal ("%s: %s", output_filename, strerror (errno));
ncopied += tocopy;
}