aboutsummaryrefslogtreecommitdiff
path: root/src/http/ngx_http_file_cache.c
diff options
context:
space:
mode:
authorMaxim Dounin <mdounin@mdounin.ru>2012-02-13 15:41:11 +0000
committerMaxim Dounin <mdounin@mdounin.ru>2012-02-13 15:41:11 +0000
commit9f38b20db50a22b434d35c9bf3c5b08d5ddfbd8b (patch)
treebf812ed61086a3746bb141c3df05ab8b4d2577cc /src/http/ngx_http_file_cache.c
parent8cb7134f49bcdded469b3e72415b96794190257e (diff)
downloadnginx-9f38b20db50a22b434d35c9bf3c5b08d5ddfbd8b.tar.gz
nginx-9f38b20db50a22b434d35c9bf3c5b08d5ddfbd8b.zip
Time parsing cleanup.
Nuke NGX_PARSE_LARGE_TIME, it's not used since 0.6.30. The only error ngx_parse_time() can currently return is NGX_ERROR, check it explicitly and make sure to cast it to appropriate type (either time_t or ngx_msec_t) to avoid signedness warnings on platforms with unsigned time_t (notably QNX).
Diffstat (limited to 'src/http/ngx_http_file_cache.c')
-rw-r--r--src/http/ngx_http_file_cache.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/src/http/ngx_http_file_cache.c b/src/http/ngx_http_file_cache.c
index 4840233ed..eb1e99015 100644
--- a/src/http/ngx_http_file_cache.c
+++ b/src/http/ngx_http_file_cache.c
@@ -1597,7 +1597,8 @@ ngx_http_file_cache_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
time_t inactive;
ssize_t size;
ngx_str_t s, name, *value;
- ngx_int_t loader_files, loader_sleep, loader_threshold;
+ ngx_int_t loader_files;
+ ngx_msec_t loader_sleep, loader_threshold;
ngx_uint_t i, n;
ngx_http_file_cache_t *cache;
@@ -1704,7 +1705,7 @@ ngx_http_file_cache_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
s.data = value[i].data + 9;
inactive = ngx_parse_time(&s, 1);
- if (inactive < 0) {
+ if (inactive == (time_t) NGX_ERROR) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"invalid inactive value \"%V\"", &value[i]);
return NGX_CONF_ERROR;
@@ -1746,7 +1747,7 @@ ngx_http_file_cache_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
s.data = value[i].data + 13;
loader_sleep = ngx_parse_time(&s, 0);
- if (loader_sleep < 0) {
+ if (loader_sleep == (ngx_msec_t) NGX_ERROR) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"invalid loader_sleep value \"%V\"", &value[i]);
return NGX_CONF_ERROR;
@@ -1761,7 +1762,7 @@ ngx_http_file_cache_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
s.data = value[i].data + 17;
loader_threshold = ngx_parse_time(&s, 0);
- if (loader_threshold < 0) {
+ if (loader_threshold == (ngx_msec_t) NGX_ERROR) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"invalid loader_threshold value \"%V\"", &value[i]);
return NGX_CONF_ERROR;
@@ -1788,8 +1789,8 @@ ngx_http_file_cache_set_slot(ngx_conf_t *cf, ngx_command_t *cmd, void *conf)
cache->path->conf_file = cf->conf_file->file.name.data;
cache->path->line = cf->conf_file->line;
cache->loader_files = loader_files;
- cache->loader_sleep = (ngx_msec_t) loader_sleep;
- cache->loader_threshold = (ngx_msec_t) loader_threshold;
+ cache->loader_sleep = loader_sleep;
+ cache->loader_threshold = loader_threshold;
if (ngx_add_path(cf, &cache->path) != NGX_OK) {
return NGX_CONF_ERROR;
@@ -1843,7 +1844,7 @@ ngx_http_file_cache_valid_set_slot(ngx_conf_t *cf, ngx_command_t *cmd,
n = cf->args->nelts - 1;
valid = ngx_parse_time(&value[n], 1);
- if (valid < 0) {
+ if (valid == (time_t) NGX_ERROR) {
ngx_conf_log_error(NGX_LOG_EMERG, cf, 0,
"invalid time value \"%V\"", &value[n]);
return NGX_CONF_ERROR;