On 24/06/18 14:34, Bruno Haible wrote: > Hi Pádraig, > > The patch looks good. Just nitpicking about the comments: > >> + /* Either process a partial fread() from this loop, >> + or the fread() in afalg_stream may have gotten EOF. >> + We need to avoid a subsequent fread() due to glibc BZ 1190. */ > > We need to avoid a subsequent fread(), not only for glibc, but also on > platforms with SystemV heritage. [1] > >> + /* Assume EOF is not sticky. See: >> + <https://sourceware.org/bugzilla/show_bug.cgi?id=19476>. */ >> + if (feof (stream)) > > You can't assume that EOF is not sticky, because per [1] > "BSDs always had sticky EOF". How about > > /* Don't assume that EOF is sticky. See: > <https://sourceware.org/bugzilla/show_bug.cgi?id=19476>. */ > > Bruno > > [1] https://sourceware.org/bugzilla/show_bug.cgi?id=1190
Yes that should have been clearer. I'll push this in a while. cheers, Pádraig diff --git a/lib/af_alg.c b/lib/af_alg.c index 9630d03..5c227fa 100644 --- a/lib/af_alg.c +++ b/lib/af_alg.c @@ -140,7 +140,7 @@ afalg_stream (FILE *stream, const char *alg, break; } - /* Assume EOF is not sticky. See: + /* Don't assume that EOF is sticky. See: <https://sourceware.org/bugzilla/show_bug.cgi?id=19476>. */ if (feof (stream)) { diff --git a/lib/md5.c b/lib/md5.c index ea69a59..2b55cc6 100644 --- a/lib/md5.c +++ b/lib/md5.c @@ -172,7 +172,9 @@ md5_stream (FILE *stream, void *resblock) { /* Either process a partial fread() from this loop, or the fread() in afalg_stream may have gotten EOF. - We need to avoid a subsequent fread() due to glibc BZ 1190. */ + We need to avoid a subsequent fread() as EOF may + not be sticky. For details of such systems, see: + https://sourceware.org/bugzilla/show_bug.cgi?id=1190 */ if (feof (stream)) goto process_partial_block;