Mercurial > hg > nginx-quic
comparison src/core/ngx_conf_file.c @ 4474:41f640a693de
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).
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Mon, 13 Feb 2012 15:41:11 +0000 |
parents | d620f497c50f |
children | 834049edae24 |
comparison
equal
deleted
inserted
replaced
4473:3b877a45d343 | 4474:41f640a693de |
---|---|
1293 *msp = ngx_parse_time(&value[1], 0); | 1293 *msp = ngx_parse_time(&value[1], 0); |
1294 if (*msp == (ngx_msec_t) NGX_ERROR) { | 1294 if (*msp == (ngx_msec_t) NGX_ERROR) { |
1295 return "invalid value"; | 1295 return "invalid value"; |
1296 } | 1296 } |
1297 | 1297 |
1298 if (*msp == (ngx_msec_t) NGX_PARSE_LARGE_TIME) { | |
1299 return "value must be less than 597 hours"; | |
1300 } | |
1301 | |
1302 if (cmd->post) { | 1298 if (cmd->post) { |
1303 post = cmd->post; | 1299 post = cmd->post; |
1304 return post->post_handler(cf, post, msp); | 1300 return post->post_handler(cf, post, msp); |
1305 } | 1301 } |
1306 | 1302 |
1324 } | 1320 } |
1325 | 1321 |
1326 value = cf->args->elts; | 1322 value = cf->args->elts; |
1327 | 1323 |
1328 *sp = ngx_parse_time(&value[1], 1); | 1324 *sp = ngx_parse_time(&value[1], 1); |
1329 if (*sp == NGX_ERROR) { | 1325 if (*sp == (time_t) NGX_ERROR) { |
1330 return "invalid value"; | 1326 return "invalid value"; |
1331 } | |
1332 | |
1333 if (*sp == NGX_PARSE_LARGE_TIME) { | |
1334 return "value must be less than 68 years"; | |
1335 } | 1327 } |
1336 | 1328 |
1337 if (cmd->post) { | 1329 if (cmd->post) { |
1338 post = cmd->post; | 1330 post = cmd->post; |
1339 return post->post_handler(cf, post, sp); | 1331 return post->post_handler(cf, post, sp); |