aboutsummaryrefslogtreecommitdiff
path: root/src/os/unix/ngx_channel.c
diff options
context:
space:
mode:
authorIgor Sysoev <igor@sysoev.ru>2008-02-19 16:34:55 +0000
committerIgor Sysoev <igor@sysoev.ru>2008-02-19 16:34:55 +0000
commit09248b7a55f660d85e70e9999090063651c99904 (patch)
treece38918a6b49883bf923d920d3df03d6eebf769e /src/os/unix/ngx_channel.c
parentbb7c84159f948bb95836d6a54c1046457c44df18 (diff)
downloadnginx-09248b7a55f660d85e70e9999090063651c99904.tar.gz
nginx-09248b7a55f660d85e70e9999090063651c99904.zip
use CMSG_LEN(), this fixes an alert "sendmsg() failed (9: Bad file descriptor)"
on some 64-bit platforms
Diffstat (limited to 'src/os/unix/ngx_channel.c')
-rw-r--r--src/os/unix/ngx_channel.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/os/unix/ngx_channel.c b/src/os/unix/ngx_channel.c
index 62ea7cc30..f0f337d06 100644
--- a/src/os/unix/ngx_channel.c
+++ b/src/os/unix/ngx_channel.c
@@ -33,7 +33,7 @@ ngx_write_channel(ngx_socket_t s, ngx_channel_t *ch, size_t size,
msg.msg_control = (caddr_t) &cmsg;
msg.msg_controllen = sizeof(cmsg);
- cmsg.cm.cmsg_len = sizeof(cmsg);
+ cmsg.cm.cmsg_len = CMSG_LEN(sizeof(int));
cmsg.cm.cmsg_level = SOL_SOCKET;
cmsg.cm.cmsg_type = SCM_RIGHTS;
*(int *) CMSG_DATA(&cmsg.cm) = ch->fd;
@@ -138,7 +138,7 @@ ngx_read_channel(ngx_socket_t s, ngx_channel_t *ch, size_t size, ngx_log_t *log)
if (ch->command == NGX_CMD_OPEN_CHANNEL) {
- if (cmsg.cm.cmsg_len < (socklen_t) sizeof(cmsg)) {
+ if (cmsg.cm.cmsg_len < (socklen_t) CMSG_LEN(sizeof(int))) {
ngx_log_error(NGX_LOG_ALERT, log, 0,
"recvmsg() returned too small ancillary data");
return NGX_ERROR;