Avoid negative return value from read()