diff options
| author | 2014-08-13 01:03:56 +0000 | |
|---|---|---|
| committer | 2014-08-13 01:03:56 +0000 | |
| commit | aee3563de2d4c13097a2f8f9bd441462e5f9932c (patch) | |
| tree | 7d5657506d6e4697beda435c3502213e1519eda7 /usr.sbin/tftpd/tftpd.c | |
| parent | setsockopt sets errno on failure, so we can use err instead of errx when (diff) | |
| download | wireguard-openbsd-aee3563de2d4c13097a2f8f9bd441462e5f9932c.tar.xz wireguard-openbsd-aee3563de2d4c13097a2f8f9bd441462e5f9932c.zip | |
use errc instead of juggling errno values in tftpd_listen.
Diffstat (limited to 'usr.sbin/tftpd/tftpd.c')
| -rw-r--r-- | usr.sbin/tftpd/tftpd.c | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/usr.sbin/tftpd/tftpd.c b/usr.sbin/tftpd/tftpd.c index 49c7b363433..053a893a93a 100644 --- a/usr.sbin/tftpd/tftpd.c +++ b/usr.sbin/tftpd/tftpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tftpd.c,v 1.20 2014/08/13 01:00:16 dlg Exp $ */ +/* $OpenBSD: tftpd.c,v 1.21 2014/08/13 01:03:56 dlg Exp $ */ /* * Copyright (c) 2012 David Gwynne <dlg@uq.edu.au> @@ -490,8 +490,8 @@ tftpd_listen(const char *addr, const char *port, int family) int error; int s; - int saved_errno; - const char *cause = NULL; + int cerrno = EADDRNOTAVAIL; + const char *cause = "getaddrinfo"; int on = 1; @@ -512,14 +512,14 @@ tftpd_listen(const char *addr, const char *port, int family) s = socket(res->ai_family, res->ai_socktype, res->ai_protocol); if (s == -1) { cause = "socket"; + cerrno = errno; continue; } if (bind(s, res->ai_addr, res->ai_addrlen) == -1) { cause = "bind"; - saved_errno = errno; + cerrno = errno; close(s); - errno = saved_errno; continue; } @@ -548,7 +548,7 @@ tftpd_listen(const char *addr, const char *port, int family) } if (TAILQ_EMPTY(&tftp_servers)) - err(1, "%s", cause); + errc(1, cerrno, "%s", cause); return (0); } |
