Loop if necessary when reading

If pread64() reads fewer bytes than required, continue reading until
the requested buffer size has been read or an error occurs.

Signed-off-by: Stephen Kitt <steve@sk2.org>