summaryrefslogtreecommitdiffhomepage
path: root/src/core
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2007-12-10 12:09:51 +0000
committerIgor Sysoev <igor@sysoev.ru>2007-12-10 12:09:51 +0000
commit86ef6aaa6b574f2015a5094670b7123c425a63af (patch)
treee0b78dcc48085162b29fbff2c0aeb7e5bd75c654 /src/core
parente60049418525a5e605765aa2b8f9c6796eb390a6 (diff)
downloadnginx-86ef6aaa6b574f2015a5094670b7123c425a63af.tar.gz
nginx-86ef6aaa6b574f2015a5094670b7123c425a63af.tar.bz2
move condition declarations inside blocks where they are used
Diffstat (limited to 'src/core')
-rw-r--r--src/core/nginx.c12
-rw-r--r--src/core/ngx_cycle.c4
-rw-r--r--src/core/ngx_file.c7
3 files changed, 10 insertions, 13 deletions
diff --git a/src/core/nginx.c b/src/core/nginx.c
index ae68605ef..ee636825b 100644
--- a/src/core/nginx.c
+++ b/src/core/nginx.c
@@ -758,12 +758,6 @@ ngx_core_module_init_conf(ngx_cycle_t *cycle, void *conf)
{
ngx_core_conf_t *ccf = conf;
-#if !(NGX_WIN32)
- ngx_str_t lock_file;
- struct group *grp;
- struct passwd *pwd;
-#endif
-
ngx_conf_init_value(ccf->daemon, 1);
ngx_conf_init_value(ccf->master, 1);
ngx_conf_init_msec_value(ccf->timer_resolution, 0);
@@ -796,6 +790,8 @@ ngx_core_module_init_conf(ngx_cycle_t *cycle, void *conf)
#if !(NGX_WIN32)
if (ccf->user == (uid_t) NGX_CONF_UNSET_UINT && geteuid() == 0) {
+ struct group *grp;
+ struct passwd *pwd;
ngx_set_errno(0);
pwd = getpwnam(NGX_USER);
@@ -848,6 +844,9 @@ ngx_core_module_init_conf(ngx_cycle_t *cycle, void *conf)
return NGX_CONF_ERROR;
}
+ {
+ ngx_str_t lock_file;
+
lock_file = cycle->old_cycle->lock_file;
if (lock_file.len) {
@@ -881,6 +880,7 @@ ngx_core_module_init_conf(ngx_cycle_t *cycle, void *conf)
ccf->lock_file.len),
".accept", sizeof(".accept"));
}
+ }
#endif
diff --git a/src/core/ngx_cycle.c b/src/core/ngx_cycle.c
index f900a2824..f0e86eb94 100644
--- a/src/core/ngx_cycle.c
+++ b/src/core/ngx_cycle.c
@@ -938,9 +938,6 @@ ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user)
ngx_uint_t i;
ngx_list_part_t *part;
ngx_open_file_t *file;
-#if !(NGX_WIN32)
- ngx_file_info_t fi;
-#endif
part = &cycle->open_files.part;
file = part->elts;
@@ -996,6 +993,7 @@ ngx_reopen_files(ngx_cycle_t *cycle, ngx_uid_t user)
}
#else
if (user != (ngx_uid_t) NGX_CONF_UNSET_UINT) {
+ ngx_file_info_t fi;
if (ngx_file_info((const char *) file[i].name.data, &fi) == -1) {
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
diff --git a/src/core/ngx_file.c b/src/core/ngx_file.c
index c945b558d..8edd3e14e 100644
--- a/src/core/ngx_file.c
+++ b/src/core/ngx_file.c
@@ -425,9 +425,6 @@ ngx_create_pathes(ngx_cycle_t *cycle, ngx_uid_t user)
ngx_err_t err;
ngx_uint_t i;
ngx_path_t **path;
-#if !(NGX_WIN32)
- ngx_file_info_t fi;
-#endif
path = cycle->pathes.elts;
for (i = 0; i < cycle->pathes.nelts; i++) {
@@ -447,6 +444,8 @@ ngx_create_pathes(ngx_cycle_t *cycle, ngx_uid_t user)
}
#if !(NGX_WIN32)
+ {
+ ngx_file_info_t fi;
if (ngx_file_info((const char *) path[i]->name.data, &fi) == -1) {
ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
@@ -474,7 +473,7 @@ ngx_create_pathes(ngx_cycle_t *cycle, ngx_uid_t user)
return NGX_ERROR;
}
}
-
+ }
#endif
}