Account for trailing bytes read from bfd_bread

* cache.c (cache_bread_1): Don't return -1 when fread returns
	a positive value.
This commit is contained in:
Alan Modra 2014-07-09 20:04:40 +09:30
parent cd3416da32
commit 87f14779da
2 changed files with 7 additions and 2 deletions

View File

@ -1,3 +1,8 @@
2014-07-15 Alan Modra <amodra@gmail.com>
* cache.c (cache_bread_1): Don't return -1 when fread returns
a positive value.
2014-07-15 Alan Modra <amodra@gmail.com>
* elflink.c (elf_merge_st_other): Update comments. Simplify

View File

@ -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)