summaryrefslogtreecommitdiff
path: root/src/or/routerlist.c
diff options
context:
space:
mode:
authorNick Mathewson <nickm@torproject.org>2007-02-12 21:39:44 +0000
committerNick Mathewson <nickm@torproject.org>2007-02-12 21:39:44 +0000
commit30e7c05075f373810a4057ecf673cb01381e6e94 (patch)
tree4562789b1e2156e66131f3450501ee57332c6f16 /src/or/routerlist.c
parent0c40a080a493c9ffc76c78e9795f64d3a194a36c (diff)
downloadtor-30e7c05075f373810a4057ecf673cb01381e6e94.tar.gz
tor-30e7c05075f373810a4057ecf673cb01381e6e94.zip
r11774@catbus: nickm | 2007-02-12 16:31:47 -0500
Handle errors on opening cached-routers* more uniformly and sanely: log not-found errors at level INFO, and all other errors at level WARN. Needs testing on win32. svn:r9569
Diffstat (limited to 'src/or/routerlist.c')
-rw-r--r--src/or/routerlist.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c
index dc98a1abb6..97b739ef8d 100644
--- a/src/or/routerlist.c
+++ b/src/or/routerlist.c
@@ -353,7 +353,7 @@ router_reload_router_list(void)
{
or_options_t *options = get_options();
size_t fname_len = strlen(options->DataDirectory)+32;
- char *fname = tor_malloc(fname_len), *contents;
+ char *fname = tor_malloc(fname_len), *contents = NULL;
if (!routerlist)
router_get_routerlist(); /* mallocs and inits it in place */
@@ -374,7 +374,8 @@ router_reload_router_list(void)
tor_snprintf(fname, fname_len, "%s/cached-routers.new",
options->DataDirectory);
- contents = read_file_to_str(fname, 1, NULL);
+ if (file_status(fname) == FN_FILE)
+ contents = read_file_to_str(fname, RFTS_BIN|RFTS_IGNORE_MISSING, NULL);
if (contents) {
router_load_routers_from_string(contents,
SAVED_IN_JOURNAL, NULL);