comparison src/core/nginx.c @ 1704:e584e946e198

move condition declarations inside blocks where they are used
author Igor Sysoev <igor@sysoev.ru>
date Mon, 10 Dec 2007 12:09:51 +0000
parents 8c696afe46b3
children 7018254cc006
comparison
equal deleted inserted replaced
1703:43747661804d 1704:e584e946e198
756 static char * 756 static char *
757 ngx_core_module_init_conf(ngx_cycle_t *cycle, void *conf) 757 ngx_core_module_init_conf(ngx_cycle_t *cycle, void *conf)
758 { 758 {
759 ngx_core_conf_t *ccf = conf; 759 ngx_core_conf_t *ccf = conf;
760 760
761 #if !(NGX_WIN32)
762 ngx_str_t lock_file;
763 struct group *grp;
764 struct passwd *pwd;
765 #endif
766
767 ngx_conf_init_value(ccf->daemon, 1); 761 ngx_conf_init_value(ccf->daemon, 1);
768 ngx_conf_init_value(ccf->master, 1); 762 ngx_conf_init_value(ccf->master, 1);
769 ngx_conf_init_msec_value(ccf->timer_resolution, 0); 763 ngx_conf_init_msec_value(ccf->timer_resolution, 0);
770 764
771 ngx_conf_init_value(ccf->worker_processes, 1); 765 ngx_conf_init_value(ccf->worker_processes, 1);
794 #endif 788 #endif
795 789
796 #if !(NGX_WIN32) 790 #if !(NGX_WIN32)
797 791
798 if (ccf->user == (uid_t) NGX_CONF_UNSET_UINT && geteuid() == 0) { 792 if (ccf->user == (uid_t) NGX_CONF_UNSET_UINT && geteuid() == 0) {
793 struct group *grp;
794 struct passwd *pwd;
799 795
800 ngx_set_errno(0); 796 ngx_set_errno(0);
801 pwd = getpwnam(NGX_USER); 797 pwd = getpwnam(NGX_USER);
802 if (pwd == NULL) { 798 if (pwd == NULL) {
803 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, 799 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno,
846 842
847 if (ngx_conf_full_name(cycle, &ccf->lock_file, 0) == NGX_ERROR) { 843 if (ngx_conf_full_name(cycle, &ccf->lock_file, 0) == NGX_ERROR) {
848 return NGX_CONF_ERROR; 844 return NGX_CONF_ERROR;
849 } 845 }
850 846
847 {
848 ngx_str_t lock_file;
849
851 lock_file = cycle->old_cycle->lock_file; 850 lock_file = cycle->old_cycle->lock_file;
852 851
853 if (lock_file.len) { 852 if (lock_file.len) {
854 lock_file.len--; 853 lock_file.len--;
855 854
879 878
880 ngx_memcpy(ngx_cpymem(cycle->lock_file.data, ccf->lock_file.data, 879 ngx_memcpy(ngx_cpymem(cycle->lock_file.data, ccf->lock_file.data,
881 ccf->lock_file.len), 880 ccf->lock_file.len),
882 ".accept", sizeof(".accept")); 881 ".accept", sizeof(".accept"));
883 } 882 }
883 }
884 884
885 #endif 885 #endif
886 886
887 return NGX_CONF_OK; 887 return NGX_CONF_OK;
888 } 888 }