This is the mail archive of the
binutils@sourceware.org
mailing list for the binutils project.
Re: [PATCH] gold: don't assume read/pread never return short counts
On Fri, Dec 7, 2012 at 1:47 PM, Roland McGrath <mcgrathr@google.com> wrote:
>
> gold/
> 2012-12-07 Roland McGrath <mcgrathr@google.com>
>
> * testsuite/binary_unittest.cc (read_all): New function.
> (Sized_binary_test): Use it instead of ::read.
> * fileread.cc (do_read): Don't assume pread always reads the whole
> amount in a single call.
> + bytes = ::pread(this->descriptor_, read_ptr, to_read, read_pos);
> + if (bytes < 0)
> + {
> + gold_fatal(_("%s: pread failed: %s"),
> + this->filename().c_str(), strerror(errno));
> + return;
> + }
No need to return after gold_fatal (I know the current code has that
too). Just take out the return statement.
This is OK with that change.
Thanks.
I don't think we need to worry about 2.23 since this is not the normal
case anyhow. The normal case is that whole_file_view_ is not NULL.
Ian