diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2005-11-13 13:22:58 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2005-11-13 13:22:58 +0000 |
commit | dcae4eedacf0eecdf10169b6f0ea06fdc73094ab (patch) | |
tree | aed5b8fccfd4db8d1b1191015c0f669fbd5785f9 /lib | |
parent | 3b0630bbc6a42a6eafe15ce4380a6a672b8916f1 (diff) |
save errno in example code. from mpech@ ok jmc@
Diffstat (limited to 'lib')
-rw-r--r-- | lib/libc/net/getaddrinfo.3 | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/libc/net/getaddrinfo.3 b/lib/libc/net/getaddrinfo.3 index 7c3bfe40d7b..b7494be811c 100644 --- a/lib/libc/net/getaddrinfo.3 +++ b/lib/libc/net/getaddrinfo.3 @@ -1,4 +1,4 @@ -.\" $OpenBSD: getaddrinfo.3,v 1.41 2005/07/05 22:21:16 dlg Exp $ +.\" $OpenBSD: getaddrinfo.3,v 1.42 2005/11/13 13:22:57 otto Exp $ .\" $KAME: getaddrinfo.3,v 1.36 2005/01/05 03:23:05 itojun Exp $ .\" .\" Copyright (C) 2004 Internet Systems Consortium, Inc. ("ISC") @@ -304,6 +304,7 @@ returns addresses that are not IPv4/v6. .Bd -literal -offset indent struct addrinfo hints, *res, *res0; int error; +int save_errno = errno; int s; const char *cause = NULL; @@ -327,6 +328,7 @@ for (res = res0; res; res = res->ai_next) { if (connect(s, res->ai_addr, res->ai_addrlen) < 0) { cause = "connect"; close(s); + errno = save_errno; s = -1; continue; } |