From a79bb41b1c43482ad2a3de028c2466c41d3780fc Mon Sep 17 00:00:00 2001
From: =?utf8?q?P=C3=A1draig=20Brady?=
Date: Sun, 24 Jun 2018 15:15:16 -0700
Subject: [PATCH] maint: clarify comments about sticky EOF
* lib/af_alg.c: Be more direct that we can't
assume stickiness of EOF for portability reasons.
* lib/md5.c: Clarify that this isn't just a glibc issue.
* lib/sha1.c: Likewise.
* lib/sha256.c: Likewise.
* lib/sha512.c: Likewise.
---
ChangeLog | 10 ++++++++++
lib/af_alg.c | 2 +-
lib/md5.c | 4 +++-
lib/sha1.c | 4 +++-
lib/sha256.c | 4 +++-
lib/sha512.c | 4 +++-
6 files changed, 23 insertions(+), 5 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 0b2f6a9228..2c1d3310b7 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2018-06-24 Pádraig Brady
+
+ maint: clarify comments about sticky EOF
+ * lib/af_alg.c: Be more direct that we can't
+ assume stickiness of EOF for portability reasons.
+ * lib/md5.c: Clarify that this isn't just a glibc issue.
+ * lib/sha1.c: Likewise.
+ * lib/sha256.c: Likewise.
+ * lib/sha512.c: Likewise.
+
2018-06-24 Bruno Haible
af_alg: Comment and style improvements.
diff --git a/lib/af_alg.c b/lib/af_alg.c
index 33d883736b..555eb2be6b 100644
--- a/lib/af_alg.c
+++ b/lib/af_alg.c
@@ -146,7 +146,7 @@ afalg_stream (FILE *stream, const char *alg,
break;
}
- /* Assume EOF is not sticky. See:
+ /* Don't assume that EOF is sticky. See:
. */
if (feof (stream))
{
diff --git a/lib/md5.c b/lib/md5.c
index ea69a59d8e..2b55cc63ad 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;
diff --git a/lib/sha1.c b/lib/sha1.c
index 1295d051cf..10676d049d 100644
--- a/lib/sha1.c
+++ b/lib/sha1.c
@@ -160,7 +160,9 @@ sha1_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;
diff --git a/lib/sha256.c b/lib/sha256.c
index bdea1bda60..c518517077 100644
--- a/lib/sha256.c
+++ b/lib/sha256.c
@@ -210,7 +210,9 @@ shaxxx_stream (FILE *stream, char const *alg, 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;
diff --git a/lib/sha512.c b/lib/sha512.c
index 863d6ba7ac..e854951eb3 100644
--- a/lib/sha512.c
+++ b/lib/sha512.c
@@ -211,7 +211,9 @@ shaxxx_stream (FILE *stream, char const *alg, 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;
--
2.39.5