Mercurial > hg > nginx-vendor-1-0
comparison src/core/ngx_cycle.c @ 16:74b1868dd3cd NGINX_0_1_8
nginx 0.1.8
*) Bugfix: in the ngx_http_autoindex_module if the long file names were
in the listing.
*) Feature: the "^~" modifier in the location directive.
*) Feature: the proxy_max_temp_file_size directive.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Sat, 20 Nov 2004 00:00:00 +0300 |
parents | 46833bd150cb |
children | 8b6db3bda591 |
comparison
equal
deleted
inserted
replaced
15:0503cb60c4e4 | 16:74b1868dd3cd |
---|---|
47 ngx_cycle_t *cycle, **old; | 47 ngx_cycle_t *cycle, **old; |
48 ngx_socket_t fd; | 48 ngx_socket_t fd; |
49 ngx_list_part_t *part; | 49 ngx_list_part_t *part; |
50 ngx_open_file_t *file; | 50 ngx_open_file_t *file; |
51 ngx_listening_t *ls, *nls; | 51 ngx_listening_t *ls, *nls; |
52 ngx_core_conf_t *ccf; | |
53 ngx_event_conf_t *ecf; | |
52 ngx_core_module_t *module; | 54 ngx_core_module_t *module; |
53 | 55 |
54 log = old_cycle->log; | 56 log = old_cycle->log; |
55 | 57 |
56 if (!(pool = ngx_create_pool(16 * 1024, log))) { | 58 if (!(pool = ngx_create_pool(16 * 1024, log))) { |
199 #if !(NGX_WIN32) | 201 #if !(NGX_WIN32) |
200 if (ngx_create_pidfile(cycle, old_cycle) == NGX_ERROR) { | 202 if (ngx_create_pidfile(cycle, old_cycle) == NGX_ERROR) { |
201 failed = 1; | 203 failed = 1; |
202 } | 204 } |
203 #endif | 205 #endif |
206 | |
207 | |
208 if (!failed) { | |
209 ccf = (ngx_core_conf_t *) ngx_get_conf(cycle->conf_ctx, | |
210 ngx_core_module); | |
211 | |
212 if (ngx_create_pathes(cycle, ccf->user) == NGX_ERROR) { | |
213 failed = 1; | |
214 } | |
215 } | |
204 | 216 |
205 | 217 |
206 if (!failed) { | 218 if (!failed) { |
207 | 219 |
208 /* open the new files */ | 220 /* open the new files */ |
419 exit(1); | 431 exit(1); |
420 } | 432 } |
421 } | 433 } |
422 } | 434 } |
423 | 435 |
436 | |
437 ecf = ngx_event_get_conf(cycle->conf_ctx, ngx_event_core_module); | |
438 | |
439 ngx_log_error(NGX_LOG_INFO, cycle->log, 0, | |
440 "using the \"%s\" event method", ecf->name); | |
441 | |
442 | |
424 /* close and delete stuff that lefts from an old cycle */ | 443 /* close and delete stuff that lefts from an old cycle */ |
425 | 444 |
426 /* close the unneeded listening sockets */ | 445 /* close the unneeded listening sockets */ |
427 | 446 |
428 ls = old_cycle->listening.elts; | 447 ls = old_cycle->listening.elts; |
695 | 714 |
696 continue; | 715 continue; |
697 } | 716 } |
698 #else | 717 #else |
699 if (user != (ngx_uid_t) -1) { | 718 if (user != (ngx_uid_t) -1) { |
700 if (chown((const char *) file[i].name.data, user, -1) == -1) { | 719 |
720 if (ngx_file_info((const char *) file[i].name.data, &fi) == -1) { | |
701 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, | 721 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, |
702 "chown \"%s\" failed", file[i].name.data); | 722 ngx_file_info_n " \"%s\" failed", |
723 file[i].name.data); | |
703 | 724 |
704 if (ngx_close_file(fd) == NGX_FILE_ERROR) { | 725 if (ngx_close_file(fd) == NGX_FILE_ERROR) { |
705 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, | 726 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, |
706 ngx_close_file_n " \"%s\" failed", | 727 ngx_close_file_n " \"%s\" failed", |
707 file[i].name.data); | 728 file[i].name.data); |
708 } | 729 } |
709 } | 730 } |
710 | 731 |
711 if (ngx_file_info((const char *) file[i].name.data, &fi) == -1) { | 732 if (fi.st_uid != user) { |
712 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, | 733 if (chown((const char *) file[i].name.data, user, -1) == -1) { |
713 ngx_file_info_n " \"%s\" failed", | |
714 file[i].name.data); | |
715 | |
716 if (ngx_close_file(fd) == NGX_FILE_ERROR) { | |
717 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, | 734 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, |
718 ngx_close_file_n " \"%s\" failed", | 735 "chown(\"%s\", %d) failed", |
719 file[i].name.data); | 736 file[i].name.data, user); |
720 } | |
721 } | |
722 | |
723 if ((fi.st_mode & (S_IRUSR|S_IWUSR)) != (S_IRUSR|S_IWUSR)) { | |
724 | |
725 fi.st_mode |= (S_IRUSR|S_IWUSR); | |
726 | |
727 if (chmod((const char *) file[i].name.data, fi.st_mode) == -1) { | |
728 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, | |
729 "chmod \"%s\" failed", | |
730 file[i].name.data); | |
731 | 737 |
732 if (ngx_close_file(fd) == NGX_FILE_ERROR) { | 738 if (ngx_close_file(fd) == NGX_FILE_ERROR) { |
733 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, | 739 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, |
734 ngx_close_file_n " \"%s\" failed", | 740 ngx_close_file_n " \"%s\" failed", |
735 file[i].name.data); | 741 file[i].name.data); |
736 } | 742 } |
737 } | 743 } |
738 } | 744 } |
745 | |
746 if ((fi.st_mode & (S_IRUSR|S_IWUSR)) != (S_IRUSR|S_IWUSR)) { | |
747 | |
748 fi.st_mode |= (S_IRUSR|S_IWUSR); | |
749 | |
750 if (chmod((const char *) file[i].name.data, fi.st_mode) == -1) { | |
751 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, | |
752 "chmod() \"%s\" failed", file[i].name.data); | |
753 | |
754 if (ngx_close_file(fd) == NGX_FILE_ERROR) { | |
755 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, | |
756 ngx_close_file_n " \"%s\" failed", | |
757 file[i].name.data); | |
758 } | |
759 } | |
760 } | |
739 } | 761 } |
740 | 762 |
741 if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) { | 763 if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1) { |
742 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, | 764 ngx_log_error(NGX_LOG_EMERG, cycle->log, ngx_errno, |
743 "fcntl(FD_CLOEXEC) \"%s\" failed", | 765 "fcntl(FD_CLOEXEC) \"%s\" failed", |