changeset 4782:e23892a0c917

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.
author Maxim Dounin <mdounin@mdounin.ru>
date Fri, 03 Aug 2012 09:10:39 +0000
parents 814541b2ec23
children 2220ce29b9d3
files src/core/ngx_times.c
diffstat 1 files changed, 4 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- 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];