aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'bfd/cache.c')
-rw-r--r--bfd/cache.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/bfd/cache.c b/bfd/cache.c
index 039c1a941b4..064cebeb3cb 100644
--- a/bfd/cache.c
+++ b/bfd/cache.c
@@ -309,6 +309,10 @@ cache_bread (struct bfd *abfd, void *buf, file_ptr nbytes)
return -1;
}
#endif
+ if (nread < nbytes)
+ /* This may or may not be an error, but in case the calling code
+ bails out because of it, set the right error code. */
+ bfd_set_error (bfd_error_file_truncated);
return nread;
}