[dovecot-cvs] dovecot/src/lib fdpass.c,1.11,1.12

cras at procontrol.fi cras at procontrol.fi
Mon Jan 6 22:14:00 EET 2003


Update of /home/cvs/dovecot/src/lib
In directory danu:/tmp/cvs-serv24483/lib

Modified Files:
	fdpass.c 
Log Message:
Still some fixes, I broke Solaris 8.



Index: fdpass.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/fdpass.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- fdpass.c	6 Jan 2003 11:34:40 -0000	1.11
+++ fdpass.c	6 Jan 2003 20:13:58 -0000	1.12
@@ -100,12 +100,14 @@
 	msg.msg_controllen = sizeof(buf);
 
 	ret = recvmsg(handle, &msg, 0);
-	if (ret <= 0)
+	if (ret <= 0) {
+		*fd = -1;
 		return ret;
+	}
 
 	/* at least one byte transferred - we should have the fd now */
 	cmsg = CMSG_FIRSTHDR(&msg);
-	if (cmsg == NULL)
+	if (cmsg == NULL || cmsg->cmsg_len < CMSG_LEN(sizeof(int)))
 		*fd = -1;
 	else
 		*fd = *((int *) CMSG_DATA(cmsg));




More information about the dovecot-cvs mailing list