summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2012-08-03 09:10:39 +0000
committerMaxim Dounin <mdounin@mdounin.ru>2012-08-03 09:10:39 +0000
commit25197b32291a35b623077c7f413003081038f4a8 (patch)
treeb98b01e7f9c7fdb8ce6fb658d00b3802e28a9d48
parentd053bacb9cbeda00b8e7c6b982258ce7b025b2bd (diff)
downloadnginx-25197b32291a35b623077c7f413003081038f4a8.tar.gz
nginx-25197b32291a35b623077c7f413003081038f4a8.tar.bz2
Fixed possible use of old cached times if runtime went backwards.
If ngx_time_sigsafe_update() updated only ngx_cached_err_log_time, and then clock was adjusted backwards, the cached_time[slot].sec might accidentally match current seconds on next ngx_time_update() call, resulting in various cached times not being updated. Fix is to clear the cached_time[slot].sec to explicitly mark cached times are stale and need updating.
-rw-r--r--src/core/ngx_times.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/core/ngx_times.c b/src/core/ngx_times.c
index ed1bf64bc..77490faf0 100644
--- a/src/core/ngx_times.c
+++ b/src/core/ngx_times.c
@@ -211,6 +211,10 @@ ngx_time_sigsafe_update(void)
slot++;
}
+ tp = &cached_time[slot];
+
+ tp->sec = 0;
+
ngx_gmtime(sec + cached_gmtoff * 60, &tm);
p = &cached_err_log_time[slot][0];