Explorar o código

- openbsd 64 tcp fix
- switched to f_malloc by default (faster)

Andrei Pelinescu-Onciul %!s(int64=20) %!d(string=hai) anos
pai
achega
7208684f1a
Modificáronse 2 ficheiros con 6 adicións e 3 borrados
  1. 2 2
      Makefile.defs
  2. 4 1
      pass_fd.c

+ 2 - 2
Makefile.defs

@@ -58,7 +58,7 @@ MAIN_NAME=ser
 VERSION = 0
 PATCHLEVEL = 9
 SUBLEVEL = 4
-EXTRAVERSION = -rc3
+EXTRAVERSION = -rc4
 
 RELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 OS = $(shell uname -s | sed -e s/SunOS/solaris/ | tr "[A-Z]" "[a-z]")
@@ -326,8 +326,8 @@ DEFS+= $(extra_defs) \
 	 -DUSE_MCAST \
 	 -DUSE_TCP \
 	 -DDISABLE_NAGLE \
+	 -DF_MALLOC \
 	 #-DDBG_QM_MALLOC \
-	 #-DF_MALLOC \
 	 #-DDBG_F_MALLOC \
 	 #-DNO_DEBUG \
 	 #-DNO_LOG \

+ 4 - 1
pass_fd.c

@@ -96,13 +96,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;