Eric Blake wrote:
> > 4. EOF when reading the first byte, no error, and offset > 0.
> > Return value was 0 and is now -1.
>
> I still think this case is like getdelim failing at EOF, particularly since...
>
> >
> > 5. EOF when reading the first byte, no error, and offset == 0.
> >
Bruno Haible clisp.org> writes:
> 3. At least one byte is read, but not stored (due to nmax), and no error.
> Return value was 0 and is now -1.
You are right that the program can usefully distinguish between -1 and 0 here
(with getdelim, there is no nmax parameter, hence getdelim can nev
Eric Blake wrote:
> It also fixes a bug where when the stream is at EOF, sometimes the
> function returned 0 and sometimes -1; the patch makes sure EOF always
> results in -1 (similar to the Posix 200x specification of getdelim always
> returning -1 at EOF).
>
> - return bytes_stored;
> + return
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
I was planning on optimizing getndelim2 to use the new extended stdio
functions for speed. But before I can do that, I need to make sure I
avoid regressions, so I'm checking this in. This also adds file locking
(similar to getdelim), but I wasn't su