]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
net_connect_ip*(): Fixed FreeBSD kludging.
authorTimo Sirainen <tss@iki.fi>
Tue, 20 Jul 2010 23:15:34 +0000 (00:15 +0100)
committerTimo Sirainen <tss@iki.fi>
Tue, 20 Jul 2010 23:15:34 +0000 (00:15 +0100)
src/lib/network.c

index abaa8c9bfc3ddb02dcbd5510707ddbe23d3cfb51..33fc4334272b2d592e893bd665e5dc4ee1f1e7f1 100644 (file)
@@ -135,16 +135,17 @@ static inline unsigned int sin_get_port(union sockaddr_union *so)
 }
 
 #ifdef __FreeBSD__
-static int net_connect_ip_freebsd(const struct ip_addr *ip, unsigned int port,
-                                 const struct ip_addr *my_ip);
+static int
+net_connect_ip_full_freebsd(const struct ip_addr *ip, unsigned int port,
+                           const struct ip_addr *my_ip, bool blocking);
 
-int net_connect_ip(const struct ip_addr *ip, unsigned int port,
-                  const struct ip_addr *my_ip)
+static int net_connect_ip_full(const struct ip_addr *ip, unsigned int port,
+                              const struct ip_addr *my_ip, bool blocking)
 {
        int fd, try;
 
        for (try = 0;;) {
-               fd = net_connect_ip_freebsd(ip, port, my_ip);
+               fd = net_connect_ip_full_freebsd(ip, port, my_ip, blocking);
                if (fd != -1 || ++try == 5 ||
                    (errno != EADDRINUSE && errno != EACCES))
                        break;
@@ -159,8 +160,7 @@ int net_connect_ip(const struct ip_addr *ip, unsigned int port,
        return fd;
 }
 /* then some kludging: */
-#define net_connect_ip net_connect_ip_freebsd
-static
+#define net_connect_ip_full net_connect_ip_full_freebsd
 #endif
 
 static int net_connect_ip_full(const struct ip_addr *ip, unsigned int port,
@@ -217,6 +217,9 @@ static int net_connect_ip_full(const struct ip_addr *ip, unsigned int port,
 
        return fd;
 }
+#ifdef __FreeBSD__
+#  undef net_connect_ip_full
+#endif
 
 int net_connect_ip(const struct ip_addr *ip, unsigned int port,
                   const struct ip_addr *my_ip)