- openbsd 64 tcp fix
authorAndrei Pelinescu-Onciul <andrei@iptel.org>
Wed, 31 Aug 2005 13:25:00 +0000 (13:25 +0000)
committerAndrei Pelinescu-Onciul <andrei@iptel.org>
Wed, 31 Aug 2005 13:25:00 +0000 (13:25 +0000)
Makefile.defs
pass_fd.c

index bef8a3c..17a1505 100644 (file)
@@ -59,7 +59,7 @@ MAIN_NAME=ser
 VERSION = 0
 PATCHLEVEL = 10
 SUBLEVEL =   99
-EXTRAVERSION = -dev14-tcp
+EXTRAVERSION = -dev15-tcp
 
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")
index 6ec15a7..43f6115 100644 (file)
--- a/pass_fd.c
+++ b/pass_fd.c
@@ -124,13 +124,16 @@ int send_fd(int unix_socket, void* data, int data_len, int fd)
        int ret;
 #ifdef HAVE_MSGHDR_MSG_CONTROL
        struct cmsghdr* cmsg;
+       /* make sure msg_control will point to properly aligned data */
        union {
                struct cmsghdr cm;
                char control[CMSG_SPACE(sizeof(fd))];
        }control_un;
        
        msg.msg_control=control_un.control;
-       msg.msg_controllen=sizeof(control_un.control);
+       /* openbsd doesn't like "more space", msg_controllen must not
+        * include the end padding */
+       msg.msg_controllen=CMSG_LEN(sizeof(fd));
        
        cmsg=CMSG_FIRSTHDR(&msg);
        cmsg->cmsg_level = SOL_SOCKET;