[dovecot-cvs] dovecot/src/lib network.c, 1.41, 1.42 network.h, 1.16, 1.17

tss at dovecot.org tss at dovecot.org
Sun Mar 18 04:01:38 EET 2007


Update of /var/lib/cvs/dovecot/src/lib
In directory talvi:/tmp/cvs-serv11515/lib

Modified Files:
	network.c network.h 
Log Message:
net_listen_unix() API changed a bit. -1 is now returned for errors that can
be ignored (remote closed the socket) and -2 for everything else.



Index: network.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/network.c,v
retrieving revision 1.41
retrieving revision 1.42
diff -u -d -r1.41 -r1.42
--- network.c	4 Nov 2006 18:45:01 -0000	1.41
+++ network.c	18 Mar 2007 02:01:35 -0000	1.42
@@ -347,11 +347,10 @@
 	ret = accept(fd, &so.sa, &addrlen);
 
 	if (ret < 0) {
-		if (errno == EBADF || errno == ENOTSOCK ||
-		    errno == EOPNOTSUPP || errno == EFAULT || errno == EINVAL)
-			return -2;
-		else
+		if (errno == EAGAIN || errno == ECONNABORTED)
 			return -1;
+		else
+			return -2;
 	}
 
 	if (addr != NULL) sin_get_ip(&so, addr);

Index: network.h
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/network.h,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- network.h	4 Nov 2006 18:45:01 -0000	1.16
+++ network.h	18 Mar 2007 02:01:35 -0000	1.17
@@ -65,8 +65,8 @@
 int net_listen(const struct ip_addr *my_ip, unsigned int *port, int backlog);
 /* Listen for connections on an UNIX socket */
 int net_listen_unix(const char *path, int backlog);
-/* Accept a connection on a socket. Returns -1 for temporary failure,
-   -2 for fatal failure */
+/* Accept a connection on a socket. Returns -1 if the connection got closed,
+   -2 for other failures */
 int net_accept(int fd, struct ip_addr *addr, unsigned int *port);
 
 /* Read data from socket, return number of bytes read,



More information about the dovecot-cvs mailing list