Possible fix for premature read() error #20

Check read() return value for errors, but accept a byte count lower than requested.
This could possibly fix #20.