suppress null termination when fgets reads EOF with no data
authorRich Felker <dalias@aerifal.cx>
Fri, 5 Sep 2014 01:37:13 +0000 (21:37 -0400)
committerRich Felker <dalias@aerifal.cx>
Fri, 5 Sep 2014 01:37:13 +0000 (21:37 -0400)
commit402611c3ba3be5b3b0486835d98e22ac7ced2722
tree306214ea557abff49bbf77fdbe97611f92530044
parent49d2c8c6bcf8c926e52c7f510033b6adc31355f5
suppress null termination when fgets reads EOF with no data

the C standard requires that "the contents of the array remain
unchanged" in this case.

this patch also changes the behavior on read errors, but in that case
"the array contents are indeterminate", so the application cannot
inspect them anyway.
src/stdio/fgets.c