diff options
author | Andrea Shepard <andrea@torproject.org> | 2014-03-18 12:39:02 -0700 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2014-03-31 11:27:08 -0400 |
commit | df076eccfaa680ee08b8ae866690d9a2a8ba5555 (patch) | |
tree | 3582108d0c51521493b1d637cfa781078cf09548 /src/or/routerlist.c | |
parent | 947a6daa311ebc139043fe39b775ee5928014fd6 (diff) | |
download | tor-df076eccfaa680ee08b8ae866690d9a2a8ba5555.tar.gz tor-df076eccfaa680ee08b8ae866690d9a2a8ba5555.zip |
Always check returns from tor_munmap_file() in microdesc.c
Diffstat (limited to 'src/or/routerlist.c')
-rw-r--r-- | src/or/routerlist.c | 22 |
1 files changed, 8 insertions, 14 deletions
diff --git a/src/or/routerlist.c b/src/or/routerlist.c index 725718be95..c96fb2c11d 100644 --- a/src/or/routerlist.c +++ b/src/or/routerlist.c @@ -990,7 +990,6 @@ router_rebuild_store(int flags, desc_store_t *store) size_t total_expected_len = 0; int had_any; int force = flags & RRS_FORCE; - int res; if (!force && !router_should_rebuild_store(store)) { r = 0; @@ -1065,10 +1064,9 @@ router_rebuild_store(int flags, desc_store_t *store) /* Our mmap is now invalid. */ if (store->mmap) { - res = tor_munmap_file(store->mmap); - if (res == 0) { - store->mmap = NULL; - } else { + int res = tor_munmap_file(store->mmap); + store->mmap = NULL; + if (res != 0) { log_warn(LD_FS, "Unable to munmap route store in %s", fname); } } @@ -1141,16 +1139,14 @@ router_reload_router_list_impl(desc_store_t *store) struct stat st; int extrainfo = (store->type == EXTRAINFO_STORE); store->journal_len = store->store_len = 0; - int res; fname = get_datadir_fname(store->fname_base); if (store->mmap) { /* get rid of it first */ - res = tor_munmap_file(store->mmap); - if (res == 0) { - store->mmap = NULL; - } else { + int res = tor_munmap_file(store->mmap); + store->mmap = NULL; + if (res != 0) { log_warn(LD_FS, "Failed to munmap %s", fname); tor_free(fname); return -1; @@ -2796,8 +2792,6 @@ extrainfo_free_(void *e) void routerlist_free(routerlist_t *rl) { - int res; - if (!rl) return; rimap_free(rl->identity_map, NULL); @@ -2811,13 +2805,13 @@ routerlist_free(routerlist_t *rl) smartlist_free(rl->routers); smartlist_free(rl->old_routers); if (routerlist->desc_store.mmap) { - res = tor_munmap_file(routerlist->desc_store.mmap); + int res = tor_munmap_file(routerlist->desc_store.mmap); if (res != 0) { log_warn(LD_FS, "Failed to munmap routerlist->desc_store.mmap"); } } if (routerlist->extrainfo_store.mmap) { - res = tor_munmap_file(routerlist->extrainfo_store.mmap); + int res = tor_munmap_file(routerlist->extrainfo_store.mmap); if (res != 0) { log_warn(LD_FS, "Failed to munmap routerlist->extrainfo_store.mmap"); } |