diff options
author | Alexander Færøy <ahf@torproject.org> | 2017-03-08 23:11:42 +0100 |
---|---|---|
committer | Alexander Færøy <ahf@torproject.org> | 2017-03-09 00:10:18 +0100 |
commit | 02fc0a5ecfc917e9261596816e926468db976453 (patch) | |
tree | 8d8c32a5d77138d12843bbde26302b6d6b16c603 /src/or/dirserv.c | |
parent | 02ef06516e64c1559b24123d7c7d164b76110c9a (diff) | |
download | tor-02fc0a5ecfc917e9261596816e926468db976453.tar.gz tor-02fc0a5ecfc917e9261596816e926468db976453.zip |
Remove fgets() compatbility function and related tests.
This patch removes the `tor_fgets()` wrapper around `fgets(3)` since it
is no longer needed. The function was created due to inconsistency
between the returned values of `fgets(3)` on different versions of Unix
when using `fgets(3)` on non-blocking file descriptors, but with the
recent changes in bug #21654 we switch from unbuffered to direct I/O on
non-blocking file descriptors in our utility module.
We continue to use `fgets(3)` directly in the geoip and dirserv module
since this usage is considered safe.
This patch also removes the test-case that was created to detect
differences in the implementation of `fgets(3)` as well as the changes
file since these changes was not included in any releases yet.
See: https://bugs.torproject.org/21654
Diffstat (limited to 'src/or/dirserv.c')
-rw-r--r-- | src/or/dirserv.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/or/dirserv.c b/src/or/dirserv.c index 2c3ce100df..f01668adcb 100644 --- a/src/or/dirserv.c +++ b/src/or/dirserv.c @@ -2701,7 +2701,7 @@ dirserv_read_measured_bandwidths(const char *from_file, return -1; } - if (!tor_fgets(line, sizeof(line), fp) + if (!fgets(line, sizeof(line), fp) || !strlen(line) || line[strlen(line)-1] != '\n') { log_warn(LD_DIRSERV, "Long or truncated time in bandwidth file: %s", escaped(line)); @@ -2731,7 +2731,7 @@ dirserv_read_measured_bandwidths(const char *from_file, while (!feof(fp)) { measured_bw_line_t parsed_line; - if (tor_fgets(line, sizeof(line), fp) && strlen(line)) { + if (fgets(line, sizeof(line), fp) && strlen(line)) { if (measured_bw_line_parse(&parsed_line, line) != -1) { /* Also cache the line for dirserv_get_bandwidth_for_router() */ dirserv_cache_measured_bw(&parsed_line, file_time); |