POSIX requires that the buffer used by getdelim/getline add a
terminating NUL whenever an EOF is read.
* libio/iogetdelim.c (__getdelim): Add a NUL byte when the first
__underflow is called.
* libio/tst-getdelim.c (do_test): Add a test case for the bug.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Convert (some) tests to use 'xfclose' rather than using plain 'fclose'
call with no error checking or plain missing such a call.
Reviewed-by: Florian Weimer <fweimer@redhat.com>
Convert tests to use 'xfmemopen' rather than open-coding error checks
with 'fmemopen' or plain missing them, where 'fmemopen' itself is not
the scope of testing. Leave 'fmemopen' tests alone.
Reviewed-by: Florian Weimer <fweimer@redhat.com>