[dovecot-cvs] dovecot/src/lib network.c,1.10,1.11 network.h,1.4,1.5
cras at procontrol.fi
cras at procontrol.fi
Tue Nov 26 15:27:15 EET 2002
Update of /home/cvs/dovecot/src/lib
In directory danu:/tmp/cvs-serv16165/lib
Modified Files:
network.c network.h
Log Message:
net_accept() returns now -2 for fatal failures.
Index: network.c
===================================================================
RCS file: /home/cvs/dovecot/src/lib/network.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- network.c 20 Nov 2002 16:59:10 -0000 1.10
+++ network.c 26 Nov 2002 13:27:13 -0000 1.11
@@ -335,8 +335,13 @@
addrlen = sizeof(so);
ret = accept(fd, &so.sa, &addrlen);
- if (ret < 0)
- return -1;
+ if (ret < 0) {
+ if (errno == EBADF || errno == ENOTSOCK ||
+ errno == EOPNOTSUPP || errno == EFAULT || errno == EINVAL)
+ return -2;
+ else
+ return -1;
+ }
if (addr != NULL) sin_get_ip(&so, addr);
if (port != NULL) *port = sin_get_port(&so);
Index: network.h
===================================================================
RCS file: /home/cvs/dovecot/src/lib/network.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- network.h 13 Oct 2002 23:49:11 -0000 1.4
+++ network.h 26 Nov 2002 13:27:13 -0000 1.5
@@ -62,7 +62,8 @@
int net_listen(IPADDR *my_ip, unsigned int *port);
/* Listen for connections on an UNIX socket */
int net_listen_unix(const char *path);
-/* Accept a connection on a socket */
+/* Accept a connection on a socket. Returns -1 for temporary failure,
+ -2 for fatal failure */
int net_accept(int fd, IPADDR *addr, unsigned int *port);
/* Read data from socket, return number of bytes read, -1 = error */
More information about the dovecot-cvs
mailing list