git://git.exim.org
/
exim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Minor robustness fixes for debugging.
[exim.git]
/
src
/
src
/
ip.c
diff --git
a/src/src/ip.c
b/src/src/ip.c
index 24929c84b0f4ab7523e0ffc9fdae2c39c5d8829f..47def415450be04a9f02575378c54c2c2752e4fb 100644
(file)
--- a/
src/src/ip.c
+++ b/
src/src/ip.c
@@
-1,10
+1,10
@@
-/* $Cambridge: exim/src/src/ip.c,v 1.
1 2004/10/07 10:39:01 ph10
Exp $ */
+/* $Cambridge: exim/src/src/ip.c,v 1.
8 2009/11/16 19:50:37 nm4
Exp $ */
/*************************************************
* Exim - an Internet mail transport agent *
*************************************************/
/*************************************************
* Exim - an Internet mail transport agent *
*************************************************/
-/* Copyright (c) University of Cambridge 1995 - 200
4
*/
+/* Copyright (c) University of Cambridge 1995 - 200
9
*/
/* See the file NOTICE for conditions of use and distribution. */
/* Functions for doing things with sockets. With the advent of IPv6 this has
/* See the file NOTICE for conditions of use and distribution. */
/* Functions for doing things with sockets. With the advent of IPv6 this has
@@
-165,7
+165,9
@@
return bind(sock, (struct sockaddr *)&sin, s_len);
*************************************************/
/* This function connects a socket to a remote address and port. The socket may
*************************************************/
/* This function connects a socket to a remote address and port. The socket may
-or may not have previously been bound to a local interface.
+or may not have previously been bound to a local interface. The socket is not
+closed, even in cases of error. It is expected that the calling function, which
+created the socket, will be the one that closes it.
Arguments:
sock the socket
Arguments:
sock the socket
@@
-224,17
+226,11
@@
alarm(0);
/* There is a testing facility for simulating a connection timeout, as I
can't think of any other way of doing this. It converts a connection refused
/* There is a testing facility for simulating a connection timeout, as I
can't think of any other way of doing this. It converts a connection refused
-into a timeout.
-
-I had to add a second fudge to keep the tests working. Attempts to connect to
-10.x.x.x are expected to timeout, but sometimes they now give "No route to
-host". */
+into a timeout if the timeout is set to 999999. */
if (running_in_test_harness)
{
if (running_in_test_harness)
{
- if ((save_errno == ECONNREFUSED && timeout == 999999) ||
- (save_errno == EHOSTUNREACH && timeout > 0 &&
- Ustrncmp(address, "10.", 3) == 0))
+ if (save_errno == ECONNREFUSED && timeout == 999999)
{
rc = -1;
save_errno = EINTR;
{
rc = -1;
save_errno = EINTR;
@@
-249,7
+245,6
@@
if (rc >= 0) return 0;
/* A failure whose error code is "Interrupted system call" is in fact
an externally applied timeout if the signal handler has been run. */
/* A failure whose error code is "Interrupted system call" is in fact
an externally applied timeout if the signal handler has been run. */
-close(sock);
errno = (save_errno == EINTR && sigalrm_seen)? ETIMEDOUT : save_errno;
return -1;
}
errno = (save_errno == EINTR && sigalrm_seen)? ETIMEDOUT : save_errno;
return -1;
}