Mercurial > dovecot > core-2.2
diff src/lib/network.c @ 14691:3945a3646c67
Changed i_close_fd() API to set the fd to -1 after closing.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 28 Jun 2012 00:27:13 +0300 |
parents | 7c058aa05b0a |
children |
line wrap: on
line diff
--- a/src/lib/network.c Wed Jun 27 12:03:51 2012 +0300 +++ b/src/lib/network.c Thu Jun 28 00:27:13 2012 +0300 @@ -209,7 +209,7 @@ sin_set_ip(&so, my_ip); if (bind(fd, &so.sa, SIZEOF_SOCKADDR(so)) == -1) { i_error("bind(%s) failed: %m", net_ip2addr(my_ip)); - i_close_fd(fd); + i_close_fd(&fd); return -1; } } @@ -225,7 +225,7 @@ if (ret < 0 && WSAGetLastError() != WSAEWOULDBLOCK) #endif { - i_close_fd(fd); + i_close_fd(&fd); return -1; } @@ -263,10 +263,10 @@ sin_set_ip(&so, ip); if (bind(fd, &so.sa, SIZEOF_SOCKADDR(so)) == -1) { - i_close_fd(fd); + i_close_fd(&fd); return -1; } - i_close_fd(fd); + i_close_fd(&fd); return 0; } @@ -295,7 +295,7 @@ /* connect */ ret = connect(fd, &sa.sa, sizeof(sa)); if (ret < 0 && errno != EINPROGRESS) { - i_close_fd(fd); + i_close_fd(&fd); return -1; } @@ -427,7 +427,7 @@ } /* error */ - i_close_fd(fd); + i_close_fd(&fd); return -1; } @@ -467,7 +467,7 @@ i_error("listen() failed: %m"); } - i_close_fd(fd); + i_close_fd(&fd); return -1; } @@ -483,7 +483,7 @@ /* see if it really exists */ fd = net_connect_unix(path); if (fd != -1 || errno != ECONNREFUSED) { - if (fd != -1) i_close_fd(fd); + if (fd != -1) i_close_fd(&fd); errno = EADDRINUSE; return -1; }