diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-08-04 16:10:35 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1996-08-04 16:10:35 +0000 |
commit | ea327cfc3c93458c412296d6163ba852e65e2156 (patch) | |
tree | b0c75860d1755b379e29679a1216e7ecd21ac313 /usr.sbin/amd/amq/amq.c | |
parent | ee7bab9d6cb2fb169688b1bc00de303d731d03f4 (diff) |
use rresvport() instead.. it is even better
Diffstat (limited to 'usr.sbin/amd/amq/amq.c')
-rw-r--r-- | usr.sbin/amd/amq/amq.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/usr.sbin/amd/amq/amq.c b/usr.sbin/amd/amq/amq.c index 92895cfe3c0..a7f5f1ffa78 100644 --- a/usr.sbin/amd/amq/amq.c +++ b/usr.sbin/amd/amq/amq.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * from: @(#)amq.c 8.1 (Berkeley) 6/7/93 - * $Id: amq.c,v 1.2 1996/08/04 15:54:43 deraadt Exp $ + * $Id: amq.c,v 1.3 1996/08/04 16:10:34 deraadt Exp $ */ /* @@ -52,7 +52,7 @@ char copyright[] = "\ #endif /* not lint */ #ifndef lint -static char rcsid[] = "$Id: amq.c,v 1.2 1996/08/04 15:54:43 deraadt Exp $"; +static char rcsid[] = "$Id: amq.c,v 1.3 1996/08/04 16:10:34 deraadt Exp $"; static char sccsid[] = "@(#)amq.c 8.1 (Berkeley) 6/7/93"; #endif /* not lint */ @@ -612,17 +612,11 @@ Usage: %s [-h host] [[-f] [-m] [-v] [-s]] | [[-u] directory ...]] |\n\ static int inetresport(ty) int ty; { - struct sockaddr_in addr; + int port = IPPORT_RESERVED - 1; int sock; - /* Use internet address family */ - bzero(&addr, sizeof addr); - addr.sin_family = AF_INET; - addr.sin_addr.s_addr = INADDR_ANY; - if ((sock = socket(AF_INET, ty, 0)) < 0) - return -1; - if (bindresvport(sock, &addr) < 0) { - close(sock); + sock = rresvport(&port); + if (sock == -1) { errno = EAGAIN; return -1; } |