Fix bug where fgets incorrectly handles \r when at end of chunk.
Summary:
Currently, when fgets see `\r` at the end of a chunk, it ignores it because it's worried that the next character will be `\n`. While that strategy correctly handles `\r\n`, it means that `\r` without `\n` is ignored and fgets will return 2 lines instead of 1.
In this diff, I fix the bug by:
- Removing the logic to ignore `\r` when at end of chunk.
- Preventing a situation where a chunk has incomplete information; chunks will never end on `\r` unless we're at end of file.
Reviewed By: ricklavoie
Differential Revision:
D38297477
fbshipit-source-id:
37c9ad6befef7f03e037a2a9ac9a37d5ee112179