Commit 79cc7f2f 79cc7f2fde35cb23f56bc245feb8625efa72118c by Sergey Poznyakoff

(_file_readline): Make sure the terminal zero is always added.

1 parent 4116d2d9
......@@ -102,6 +102,7 @@ _file_readline (stream_t stream, char *optr, size_t osize,
if (!fs->file)
{
optr[0] = 0;
if (nbytes)
*nbytes = 0;
return 0;
......@@ -131,6 +132,7 @@ _file_readline (stream_t stream, char *optr, size_t osize,
err = errno;
}
optr[n] = 0;
if (nbytes)
*nbytes = n;
return err;
......