Browse code

- openbsd 64 tcp fix

Andrei Pelinescu-Onciul authored on 31/08/2005 13:25:00
Showing 2 changed files
... ...
@@ -59,7 +59,7 @@ MAIN_NAME=ser
59 59
 VERSION = 0
60 60
 PATCHLEVEL = 10
61 61
 SUBLEVEL =   99
62
-EXTRAVERSION = -dev14-tcp
62
+EXTRAVERSION = -dev15-tcp
63 63
 
64 64
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
65 65
 OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")
... ...
@@ -124,13 +124,16 @@ int send_fd(int unix_socket, void* data, int data_len, int fd)
124 124
 	int ret;
125 125
 #ifdef HAVE_MSGHDR_MSG_CONTROL
126 126
 	struct cmsghdr* cmsg;
127
+	/* make sure msg_control will point to properly aligned data */
127 128
 	union {
128 129
 		struct cmsghdr cm;
129 130
 		char control[CMSG_SPACE(sizeof(fd))];
130 131
 	}control_un;
131 132
 	
132 133
 	msg.msg_control=control_un.control;
133
-	msg.msg_controllen=sizeof(control_un.control);
134
+	/* openbsd doesn't like "more space", msg_controllen must not
135
+	 * include the end padding */
136
+	msg.msg_controllen=CMSG_LEN(sizeof(fd));
134 137
 	
135 138
 	cmsg=CMSG_FIRSTHDR(&msg);
136 139
 	cmsg->cmsg_level = SOL_SOCKET;