[dovecot-cvs] dovecot/src/lib network.c,1.30,1.31

cras at dovecot.org cras at dovecot.org
Mon Aug 15 02:19:31 EEST 2005


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

Modified Files:
	network.c 
Log Message:
net_listen(): Print bind() errors only if it's not EADDRINUSE. Also do the
same for listen().



Index: network.c
===================================================================
RCS file: /var/lib/cvs/dovecot/src/lib/network.c,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- network.c	7 Aug 2005 13:06:56 -0000	1.30
+++ network.c	14 Aug 2005 23:19:29 -0000	1.31
@@ -293,9 +293,12 @@
 #endif
 	/* specify the address/port we want to listen in */
 	ret = bind(fd, &so.sa, SIZEOF_SOCKADDR(so));
-	if (ret < 0)
-		i_error("bind(%s) failed: %m", net_ip2addr(my_ip));
-	else {
+	if (ret < 0) {
+		if (errno != EADDRINUSE) {
+			i_error("bind(%s, %u) failed: %m",
+				net_ip2addr(my_ip), *port);
+		}
+	} else {
 		/* get the actual port we started listen */
 		len = SIZEOF_SOCKADDR(so);
 		ret = getsockname(fd, &so.sa, &len);
@@ -304,7 +307,10 @@
 
 			/* start listening */
 			if (listen(fd, backlog) >= 0)
-                                return fd;
+				return fd;
+
+			if (errno != EADDRINUSE)
+				i_error("listen() failed: %m");
 		}
 	}
 



More information about the dovecot-cvs mailing list