Mercurial > hg > nginx-vendor-current
annotate src/os/unix/ngx_errno.c @ 694:88a1b4797f2e NGINX_1_3_10
nginx 1.3.10
*) Change: domain names specified in configuration file are now resolved
to IPv6 addresses as well as IPv4 ones.
*) Change: now if the "include" directive with mask is used on Unix
systems, included files are sorted in alphabetical order.
*) Change: the "add_header" directive adds headers to 201 responses.
*) Feature: the "geo" directive now supports IPv6 addresses in CIDR
notation.
*) Feature: the "flush" and "gzip" parameters of the "access_log"
directive.
*) Feature: variables support in the "auth_basic" directive.
*) Bugfix: nginx could not be built with the ngx_http_perl_module in
some cases.
*) Bugfix: a segmentation fault might occur in a worker process if the
ngx_http_xslt_module was used.
*) Bugfix: nginx could not be built on MacOSX in some cases.
Thanks to Piotr Sikora.
*) Bugfix: the "limit_rate" directive with high rates might result in
truncated responses on 32-bit platforms.
Thanks to Alexey Antropov.
*) Bugfix: a segmentation fault might occur in a worker process if the
"if" directive was used.
Thanks to Piotr Sikora.
*) Bugfix: a "100 Continue" response was issued with "413 Request Entity
Too Large" responses.
*) Bugfix: the "image_filter", "image_filter_jpeg_quality" and
"image_filter_sharpen" directives might be inherited incorrectly.
Thanks to Ian Babrou.
*) Bugfix: "crypt_r() failed" errors might appear if the "auth_basic"
directive was used on Linux.
*) Bugfix: in backup servers handling.
Thanks to Thomas Chen.
*) Bugfix: proxied HEAD requests might return incorrect response if the
"gzip" directive was used.
author | Igor Sysoev <http://sysoev.ru> |
---|---|
date | Tue, 25 Dec 2012 00:00:00 +0400 |
parents | 981b4c44593b |
children |
rev | line source |
---|---|
0 | 1 |
2 /* | |
3 * Copyright (C) Igor Sysoev | |
660 | 4 * Copyright (C) Nginx, Inc. |
0 | 5 */ |
6 | |
7 | |
8 #include <ngx_config.h> | |
9 #include <ngx_core.h> | |
10 | |
11 | |
604 | 12 /* |
13 * The strerror() messages are copied because: | |
14 * | |
15 * 1) strerror() and strerror_r() functions are not Async-Signal-Safe, | |
640 | 16 * therefore, they cannot be used in signal handlers; |
604 | 17 * |
18 * 2) a direct sys_errlist[] array may be used instead of these functions, | |
19 * but Linux linker warns about its usage: | |
20 * | |
21 * warning: `sys_errlist' is deprecated; use `strerror' or `strerror_r' instead | |
22 * warning: `sys_nerr' is deprecated; use `strerror' or `strerror_r' instead | |
23 * | |
24 * causing false bug reports. | |
25 */ | |
0 | 26 |
27 | |
604 | 28 static ngx_str_t *ngx_sys_errlist; |
29 static ngx_str_t ngx_unknown_error = ngx_string("Unknown error"); | |
0 | 30 |
31 | |
422 | 32 u_char * |
604 | 33 ngx_strerror(ngx_err_t err, u_char *errstr, size_t size) |
34 { | |
35 ngx_str_t *msg; | |
36 | |
37 msg = ((ngx_uint_t) err < NGX_SYS_NERR) ? &ngx_sys_errlist[err]: | |
38 &ngx_unknown_error; | |
39 size = ngx_min(size, msg->len); | |
40 | |
41 return ngx_cpymem(errstr, msg->data, size); | |
42 } | |
43 | |
44 | |
678 | 45 ngx_int_t |
604 | 46 ngx_strerror_init(void) |
0 | 47 { |
604 | 48 char *msg; |
49 u_char *p; | |
50 size_t len; | |
51 ngx_err_t err; | |
0 | 52 |
604 | 53 /* |
54 * ngx_strerror() is not ready to work at this stage, therefore, | |
55 * malloc() is used and possible errors are logged using strerror(). | |
56 */ | |
57 | |
58 len = NGX_SYS_NERR * sizeof(ngx_str_t); | |
59 | |
60 ngx_sys_errlist = malloc(len); | |
61 if (ngx_sys_errlist == NULL) { | |
62 goto failed; | |
0 | 63 } |
64 | |
604 | 65 for (err = 0; err < NGX_SYS_NERR; err++) { |
66 msg = strerror(err); | |
67 len = ngx_strlen(msg); | |
0 | 68 |
604 | 69 p = malloc(len); |
70 if (p == NULL) { | |
71 goto failed; | |
72 } | |
0 | 73 |
604 | 74 ngx_memcpy(p, msg, len); |
75 ngx_sys_errlist[err].len = len; | |
76 ngx_sys_errlist[err].data = p; | |
0 | 77 } |
78 | |
604 | 79 return NGX_OK; |
80 | |
81 failed: | |
0 | 82 |
604 | 83 err = errno; |
84 ngx_log_stderr(0, "malloc(%uz) failed (%d: %s)", len, err, strerror(err)); | |
85 | |
86 return NGX_ERROR; | |
0 | 87 } |