This should not be changed. The docs specify that the end of file is -1, not 0. If this leads to an infinite loop, then intentionally fail the test early.