diff options
author | Alexander Færøy <ahf@torproject.org> | 2017-02-27 15:42:57 +0100 |
---|---|---|
committer | Alexander Færøy <ahf@torproject.org> | 2017-03-01 21:26:27 +0100 |
commit | 3dca5a6e71929f88c9c76f6ebbaac58789884b6e (patch) | |
tree | 98494b44b88ba4eecbe3a919fb9d288da4c17de1 /src/or/dirserv.c | |
parent | 498287b3c340739bede9a3fa95ea23b6ae650bf3 (diff) | |
download | tor-3dca5a6e71929f88c9c76f6ebbaac58789884b6e.tar.gz tor-3dca5a6e71929f88c9c76f6ebbaac58789884b6e.zip |
Use tor_fgets() instead of fgets().
This patch changes our use of fgets() to tor_fgets() for more consistent
error handling across different versions of the C library.
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 f01668adcb..2c3ce100df 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 (!fgets(line, sizeof(line), fp) + if (!tor_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 (fgets(line, sizeof(line), fp) && strlen(line)) { + if (tor_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); |