comparison src/os/unix/ngx_errno.c @ 10:46833bd150cb NGINX_0_1_5

nginx 0.1.5 *) Bugfix: on Solaris and Linux there may be too many "recvmsg() returned not enough data" alerts. *) Bugfix: there were the "writev() failed (22: Invalid argument)" errors on Solaris in proxy mode without sendfile. On other platforms that do not support sendfile at all the process got caught in an endless loop. *) Bugfix: segmentation fault on Solaris in proxy mode and using sendfile. *) Bugfix: segmentation fault on Solaris. *) Bugfix: on-line upgrade did not work on Linux. *) Bugfix: the ngx_http_autoindex_module module did not escape the spaces, the quotes, and the percent signs in the directory listing. *) Change: the decrease of the copy operations. *) Feature: the userid_p3p directive.
author Igor Sysoev <http://sysoev.ru>
date Thu, 11 Nov 2004 00:00:00 +0300
parents 80ba094c6b3e
children 6f8b0dc0f8dd
comparison
equal deleted inserted replaced
9:77eee314ddbd 10:46833bd150cb
8 #include <ngx_core.h> 8 #include <ngx_core.h>
9 9
10 10
11 #if (NGX_STRERROR_R) 11 #if (NGX_STRERROR_R)
12 12
13 ngx_int_t ngx_strerror_r(int err, char *errstr, size_t size) 13 u_char *ngx_strerror_r(int err, u_char *errstr, size_t size)
14 { 14 {
15 size_t len;
16
17 if (size == 0) { 15 if (size == 0) {
18 return 0; 16 return 0;
19 } 17 }
20 18
21 errstr[0] = '\0'; 19 errstr[0] = '\0';
22 20
23 strerror_r(err, errstr, size); 21 strerror_r(err, (char *) errstr, size);
24 22
25 for (len = 0; len < size; len++) { 23 while (*errstr && size) {
26 if (errstr[len] == '\0') { 24 errstr++;
27 break; 25 size--;
28 }
29 } 26 }
30 27
31 return len; 28 return errstr;
32 } 29 }
33 30
34 #elif (NGX_GNU_STRERROR_R) 31 #elif (NGX_GNU_STRERROR_R)
35 32
36 /* Linux strerror_r() */ 33 /* Linux strerror_r() */
37 34
38 ngx_int_t ngx_strerror_r(int err, char *errstr, size_t size) 35 u_char *ngx_strerror_r(int err, u_char *errstr, size_t size)
39 { 36 {
40 char *str; 37 char *str;
41 size_t len; 38 size_t len;
42 39
43 if (size == 0) { 40 if (size == 0) {
44 return 0; 41 return 0;
45 } 42 }
46 43
47 errstr[0] = '\0'; 44 errstr[0] = '\0';
48 45
49 str = strerror_r(err, errstr, size); 46 str = strerror_r(err, (char *) errstr, size);
50 47
51 if (str != errstr) { 48 if (str != (char *) errstr) {
52 return ngx_cpystrn((u_char *) errstr, (u_char *) str, size) 49 return ngx_cpystrn(errstr, (u_char *) str, size);
53 - (u_char *) errstr;
54 } 50 }
55 51
56 for (len = 0; len < size; len++) { 52 while (*errstr && size) {
57 if (errstr[len] == '\0') { 53 errstr++;
58 break; 54 size--;
59 }
60 } 55 }
61 56
62 return len; 57 return errstr;
63 } 58 }
64 59
65 #endif 60 #endif