From: Mark Wooding Date: Sat, 26 Dec 2009 12:16:09 +0000 (+0000) Subject: Merge branch 'master' of metalzone:public-git/preload-hacks X-Git-Tag: 1.0.5~1 X-Git-Url: https://git.distorted.org.uk/~mdw/preload-hacks/commitdiff_plain/79f4d4db843c9a1c6cc2872ee06ed56f883d6817?hp=bd3fedaf2109627e72c202340a33ed51f10ea9e3 Merge branch 'master' of metalzone:public-git/preload-hacks * 'master' of metalzone:public-git/preload-hacks: Version 1.0.4. noip (decode_inet_addr): Be more careful when converting addresses. noip: Don't try to support families other than AF_UNIX and AF_INET. --- diff --git a/README b/README index 980f5a4..b067845 100644 --- a/README +++ b/README @@ -261,6 +261,25 @@ noip stuff that Emacs does magically find the SSH tunnel and work without me having to care. + Testing + + noip provides a handy way for testing network servers and so on + safely. For a start, you can run your test server apparently on + the same port as the real one. Because noip consults the + environment variable NOIP_SOCKETDIR to find out where to put its + sockets, you can run two at a time and they don't interfere. + And noip doesn't care what port numbers your program tries to + bind, so you don't need to jump through stupid hoops in order to + test programs which use `privileged' ports. + + Other applications + + There are certainly loads of handy things you can do with noip. + If you think of one, let me know! + + Mark Wooding + mdw@distorted.org.uk + Local variables: mode: text diff --git a/noip.c b/noip.c index 04abe93..237bfd0 100644 --- a/noip.c +++ b/noip.c @@ -882,17 +882,22 @@ int connect(int sk, const struct sockaddr *sa, socklen_t len) int fixup_p = 0; int rc; - if (sa->sa_family == AF_INET) { - PRESERVING_ERRNO({ - do_implicit_bind(sk, &sa, &len, &sun); - fixup_p = 1; - }); - } - rc = real_connect(sk, sa, len); - if (rc < 0) { - switch (errno) { - case ENOENT: errno = ECONNREFUSED; break; - } + switch (sa->sa_family) { + case AF_INET: + PRESERVING_ERRNO({ + do_implicit_bind(sk, &sa, &len, &sun); + fixup_p = 1; + }); + rc = real_connect(sk, sa, len); + if (rc < 0) { + switch (errno) { + case ENOENT: errno = ECONNREFUSED; break; + } + } + break; + default: + rc = real_connect(sk, sa, len); + break; } return rc; }