Mercurial > hg > nginx-ranges
annotate src/os/unix/ngx_daemon.c @ 520:24b676623d4f NGINX_0_8_7
nginx 0.8.7
*) Change: minimum supported OpenSSL version is 0.9.7.
*) Change: the "ask" parameter of the "ssl_verify_client" directive was
changed to the "optional" parameter and now it checks a client
certificate if it was offered.
Thanks to Brice Figureau.
*) Feature: the $ssl_client_verify variable.
Thanks to Brice Figureau.
*) Feature: the "ssl_crl" directive.
Thanks to Brice Figureau.
*) Feature: the "proxy" parameter of the "geo" directive.
*) Feature: the "image_filter" directive supports variables for setting
size.
*) Bugfix: the $ssl_client_cert variable usage corrupted memory; the
bug had appeared in 0.7.7.
Thanks to Sergey Zhuravlev.
*) Bugfix: "proxy_pass_header" and "fastcgi_pass_header" directives did
not pass to a client the "X-Accel-Redirect", "X-Accel-Limit-Rate",
"X-Accel-Buffering", and "X-Accel-Charset" lines from backend
response header.
Thanks to Maxim Dounin.
*) Bugfix: in handling "Last-Modified" and "Accept-Ranges" backend
response header lines; the bug had appeared in 0.7.44.
Thanks to Maxim Dounin.
*) Bugfix: the "[alert] zero size buf" error if subrequest returns an
empty response; the bug had appeared in 0.8.5.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Mon, 27 Jul 2009 00:00:00 +0400 |
parents | 6cfc63e68377 |
children |
rev | line source |
---|---|
0 | 1 |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
4 */ | |
5 | |
6 | |
7 #include <ngx_config.h> | |
8 #include <ngx_core.h> | |
9 | |
10 | |
48 | 11 ngx_int_t ngx_daemon(ngx_log_t *log) |
0 | 12 { |
13 int fd; | |
14 | |
15 switch (fork()) { | |
16 case -1: | |
17 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "fork() failed"); | |
18 return NGX_ERROR; | |
19 | |
20 case 0: | |
21 break; | |
22 | |
23 default: | |
24 exit(0); | |
25 } | |
26 | |
27 ngx_pid = ngx_getpid(); | |
28 | |
29 if (setsid() == -1) { | |
30 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "setsid() failed"); | |
31 return NGX_ERROR; | |
32 } | |
33 | |
34 umask(0); | |
35 | |
36 fd = open("/dev/null", O_RDWR); | |
37 if (fd == -1) { | |
38 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, | |
39 "open(\"/dev/null\") failed"); | |
40 return NGX_ERROR; | |
41 } | |
42 | |
43 if (dup2(fd, STDIN_FILENO) == -1) { | |
44 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "dup2(STDIN) failed"); | |
45 return NGX_ERROR; | |
46 } | |
47 | |
48 if (dup2(fd, STDOUT_FILENO) == -1) { | |
49 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "dup2(STDOUT) failed"); | |
50 return NGX_ERROR; | |
51 } | |
52 | |
53 #if 0 | |
54 if (dup2(fd, STDERR_FILENO) == -1) { | |
55 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "dup2(STDERR) failed"); | |
56 return NGX_ERROR; | |
57 } | |
58 #endif | |
59 | |
60 if (fd > STDERR_FILENO) { | |
61 if (close(fd) == -1) { | |
62 ngx_log_error(NGX_LOG_EMERG, log, ngx_errno, "close() failed"); | |
63 return NGX_ERROR; | |
64 } | |
65 } | |
66 | |
67 return NGX_OK; | |
68 } |