diff options
author | Taylor Yu <catalyst@torproject.org> | 2017-09-20 16:54:56 -0500 |
---|---|---|
committer | Taylor Yu <catalyst@torproject.org> | 2017-09-20 18:50:39 -0500 |
commit | 1c017edac369a40c9a1633b0560e5f0d85b4e39e (patch) | |
tree | 770c534da00000ae1998593b9ad6410c70f50d9d /src/or/statefile.c | |
parent | ac8e26a41592e5a87a5613cfbeb4c5d975835e4d (diff) | |
download | tor-1c017edac369a40c9a1633b0560e5f0d85b4e39e.tar.gz tor-1c017edac369a40c9a1633b0560e5f0d85b4e39e.zip |
Use correct sign for state file clock skew
or_state_load() was using an incorrect sign convention when calling
clock_skew_warning() to warn about state file clock skew. This caused
the wording of the warning to be incorrect about the direction of the
skew.
Diffstat (limited to 'src/or/statefile.c')
-rw-r--r-- | src/or/statefile.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/or/statefile.c b/src/or/statefile.c index 9647aa8834..86f26419be 100644 --- a/src/or/statefile.c +++ b/src/or/statefile.c @@ -404,8 +404,8 @@ or_state_load(void) log_info(LD_GENERAL, "Loaded state from \"%s\"", fname); /* Warn the user if their clock has been set backwards, * they could be tricked into using old consensuses */ - time_t apparent_skew = new_state->LastWritten - time(NULL); - if (apparent_skew > 0) + time_t apparent_skew = time(NULL) - new_state->LastWritten; + if (apparent_skew < 0) clock_skew_warning(NULL, (long)apparent_skew, 1, LD_GENERAL, "local state file", fname); } else { |