comparison src/os/unix/ngx_channel.c @ 558:2da4537168f8 NGINX_0_8_31

nginx 0.8.31 *) Feature: now the "error_page" directive may redirect the 301 and 302 responses. *) Feature: the $geoip_city_continent_code, $geoip_latitude, and $geoip_longitude variables. Thanks to Arvind Sundararajan. *) Feature: now the ngx_http_image_filter_module deletes always EXIF and other application specific data if the data consume more than 5% of a JPEG file. *) Bugfix: nginx closed a connection if a cached response had an empty body. Thanks to Piotr Sikora. *) Bugfix: nginx might not be built by gcc 4.x if the -O2 or higher optimization option was used. Thanks to Maxim Dounin and Denis F. Latypoff. *) Bugfix: regular expressions in location were always tested in case-sensitive mode; the bug had appeared in 0.8.25. *) Bugfix: nginx cached a 304 response if there was the "If-None-Match" header line in a proxied request. Thanks to Tim Dettrick and David Kostal. *) Bugfix: nginx/Windows tried to delete a temporary file twice if the file should replace an already existent file.
author Igor Sysoev <http://sysoev.ru>
date Wed, 23 Dec 2009 00:00:00 +0300
parents babd3d9efb62
children 53f5f04a64b8
comparison
equal deleted inserted replaced
557:72104cd120ec 558:2da4537168f8
34 msg.msg_controllen = sizeof(cmsg); 34 msg.msg_controllen = sizeof(cmsg);
35 35
36 cmsg.cm.cmsg_len = CMSG_LEN(sizeof(int)); 36 cmsg.cm.cmsg_len = CMSG_LEN(sizeof(int));
37 cmsg.cm.cmsg_level = SOL_SOCKET; 37 cmsg.cm.cmsg_level = SOL_SOCKET;
38 cmsg.cm.cmsg_type = SCM_RIGHTS; 38 cmsg.cm.cmsg_type = SCM_RIGHTS;
39 *(int *) CMSG_DATA(&cmsg.cm) = ch->fd; 39
40 /*
41 * We have to use ngx_memcpy() instead of simple
42 * *(int *) CMSG_DATA(&cmsg.cm) = ch->fd;
43 * because some gcc 4.4 with -O2/3/s optimization issues the warning:
44 * dereferencing type-punned pointer will break strict-aliasing rules
45 *
46 * Fortunately, gcc with -O1 compiles this ngx_memcpy()
47 * in the same simple assigment as in the code above
48 */
49
50 ngx_memcpy(CMSG_DATA(&cmsg.cm), &ch->fd, sizeof(int));
40 } 51 }
41 52
42 msg.msg_flags = 0; 53 msg.msg_flags = 0;
43 54
44 #else 55 #else
151 "level %d or type %d", 162 "level %d or type %d",
152 cmsg.cm.cmsg_level, cmsg.cm.cmsg_type); 163 cmsg.cm.cmsg_level, cmsg.cm.cmsg_type);
153 return NGX_ERROR; 164 return NGX_ERROR;
154 } 165 }
155 166
156 ch->fd = *(int *) CMSG_DATA(&cmsg.cm); 167 /* ch->fd = *(int *) CMSG_DATA(&cmsg.cm); */
168
169 ngx_memcpy(&ch->fd, CMSG_DATA(&cmsg.cm), sizeof(int));
157 } 170 }
158 171
159 if (msg.msg_flags & (MSG_TRUNC|MSG_CTRUNC)) { 172 if (msg.msg_flags & (MSG_TRUNC|MSG_CTRUNC)) {
160 ngx_log_error(NGX_LOG_ALERT, log, 0, 173 ngx_log_error(NGX_LOG_ALERT, log, 0,
161 "recvmsg() truncated data"); 174 "recvmsg() truncated data");