aboutsummaryrefslogtreecommitdiff
path: root/bfd/cache.c
diff options
context:
space:
mode:
authorAlan Modra <amodra@gmail.com>2014-07-09 20:04:40 +0930
committerAlan Modra <amodra@gmail.com>2014-07-15 13:48:08 +0930
commit87f14779da25380b2e1ee67edcf984f0f8c922c4 (patch)
treefda1e2b6b89edb6cbb28d83af4fdfd9c169b2755 /bfd/cache.c
parentcd3416da32a950d8ff4fee2863df57bb3f4b7c51 (diff)
downloadgdb-87f14779da25380b2e1ee67edcf984f0f8c922c4.zip
gdb-87f14779da25380b2e1ee67edcf984f0f8c922c4.tar.gz
gdb-87f14779da25380b2e1ee67edcf984f0f8c922c4.tar.bz2
Account for trailing bytes read from bfd_bread
* cache.c (cache_bread_1): Don't return -1 when fread returns a positive value.
Diffstat (limited to 'bfd/cache.c')
-rw-r--r--bfd/cache.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/bfd/cache.c b/bfd/cache.c
index 27fe70a..ffda004 100644
--- a/bfd/cache.c
+++ b/bfd/cache.c
@@ -310,7 +310,7 @@ cache_bread_1 (struct bfd *abfd, void *buf, file_ptr nbytes)
if (nread == (file_ptr)-1)
{
bfd_set_error (bfd_error_system_call);
- return -1;
+ return nread;
}
#else
nread = fread (buf, 1, nbytes, f);
@@ -320,7 +320,7 @@ cache_bread_1 (struct bfd *abfd, void *buf, file_ptr nbytes)
if (nread < nbytes && ferror (f))
{
bfd_set_error (bfd_error_system_call);
- return -1;
+ return nread;
}
#endif
if (nread < nbytes)