diff options
author | Nick Mathewson <nickm@torproject.org> | 2013-03-11 14:52:56 -0400 |
---|---|---|
committer | Nick Mathewson <nickm@torproject.org> | 2013-03-11 14:53:41 -0400 |
commit | 1eebb566911380c22768a8d25061a8f917688349 (patch) | |
tree | e1b33ef1fe9bb189152df585560c77bdb561bb51 | |
parent | 6905c1f60d2d0e658481df70fdcaa73251becacc (diff) | |
download | tor-1eebb566911380c22768a8d25061a8f917688349.tar tor-1eebb566911380c22768a8d25061a8f917688349.tar.gz |
Another possible diagnostic for 8031.
This time, I'm checking whether our calculated offset matches our
real offset, in each case, as we go along. I don't think this is
the bug, but it can't hurt to check.
-rw-r--r-- | src/or/microdesc.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/src/or/microdesc.c b/src/or/microdesc.c index 7d3f631a3..bb9668da5 100644 --- a/src/or/microdesc.c +++ b/src/or/microdesc.c @@ -415,7 +415,7 @@ microdesc_cache_rebuild(microdesc_cache_t *cache, int force) microdesc_t **mdp; smartlist_t *wrote; ssize_t size; - off_t off = 0; + off_t off = 0, off_real; int orig_size, new_size; if (cache == NULL) { @@ -458,6 +458,14 @@ microdesc_cache_rebuild(microdesc_cache_t *cache, int force) tor_assert(((size_t)size) == annotation_len + md->bodylen); md->off = off + annotation_len; off += size; + off_real = tor_fd_getpos(fd); + if (off_real != off) { + log_warn(LD_BUG, "Discontinuity in position in microdescriptor cache." + "By my count, I'm at "I64_FORMAT + ", but I should be at "I64_FORMAT, + I64_PRINTF_ARG(off), I64_PRINTF_ARG(off_real)); + off = off_real; + } if (md->saved_location != SAVED_IN_CACHE) { tor_free(md->body); md->saved_location = SAVED_IN_CACHE; |