This means that fgets returns a null pointer on partial lines instead of the buffer as expected.
Previously this test was passing but started failing with build #105. Looking at the changes to libc it looks like this is caused by revision 305413 (which was added earlier in the same month the test started failing).
I'm unsure whether FreeBSD is right and other libc implementations are wrong or the other way around.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items
0
Show closed items
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Linked items
0
Link issues together to show that they're related.
Learn more.
diff --git a/src/common/compat.c b/src/common/compat.cindex 771cc085d..753ad3f8f 100644--- a/src/common/compat.c+++ b/src/common/compat.c@@ -3480,7 +3480,7 @@ tor_getpass(const char *prompt, char *output, size_t buflen) * Upon successful completion, this function returns a pointer to the string * <b>str</b>. If EOF occurs before any characters are read the function will * return NULL and the content of <b>str</b> is unchanged. Upon error, the- * function return NULL and the caller must check for error using foef(3) and+ * function returns NULL and the caller must check for error using foef(3) and * ferror(3). */ char *@@ -3490,10 +3490,10 @@ tor_fgets(char *str, int size, FILE *stream) ret = fgets(str, size, stream);- /* FreeBSD, OpenBSD, Linux (glibc), and Linux (musl) seems to disagree about+ /* FreeBSD, OpenBSD, Linux (glibc), and Linux (musl) seem to disagree about * what to do in the given situation. We check if the stream has been flagged- * with an error-bit and retur NULL in that situation if errno is also set to- * EAGAIN.+ * with an error-bit and return NULL in that situation if errno is also set+ * to EAGAIN. */ if (ferror(stream) && errno == EAGAIN) return NULL;
I've updated my branch with the following changes:
Fixed typos reported by OP. Thanks!
Added a changes file.
We now clear the error flag on the file handler in the case where ferror(stream) && errno == EAGAIN to prevent the situation where the caller receives an error return value and retries because of errno being EAGAIN, but continues to have the error flag set.
I ran make check and tested it with "normal" browsing usage on OS X, HardenedBSD, and Linux.
Trac: Cc: N/Ato ahf Status: needs_revision to needs_review