Add compatibility function for fgets(3).

This patch adds the `tor_fgets()` function to our compatibility layer.

`tor_fgets()` adds an additional check for whether the error-bit have
been enabled for the given file stream, if that is the case and `errno`
is set to `EAGAIN` we make sure that we always return NULL.

Unfortunately `fgets(3)` behaves differently on different versions of
the C library.

See: https://bugs.torproject.org/21416
See: https://bugs.torproject.org/20988
This commit is contained in:
Alexander Færøy
2017-02-27 15:37:31 +01:00
parent a0a4f8ae5d
commit 498287b3c3
3 changed files with 45 additions and 0 deletions
+4
View File
@@ -0,0 +1,4 @@
o Minor bugfixes (portability):
- Add Tor compatibility function for fgets(3) due to inconsistency of
returned values in different supported C libraries. This fixes unit test
failures reported on FreeBSD. Fixes bug 20988.