summaryrefslogtreecommitdiff
path: root/usr.sbin
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-10 21:39:44 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>1996-08-10 21:39:44 +0000
commit9392a0d20bd3087247d0122567d2147d16bf3f97 (patch)
treeb5d423cbbe1e34f71273131483b77bc916f4e3c9 /usr.sbin
parente5b7559c19039063b8bb2138a07e59a93db000d3 (diff)
call bindresvport() instead of faking it badly
Diffstat (limited to 'usr.sbin')
-rw-r--r--usr.sbin/amd/amd/util.c14
1 files changed, 3 insertions, 11 deletions
diff --git a/usr.sbin/amd/amd/util.c b/usr.sbin/amd/amd/util.c
index 3087049d261..e64c53df3b0 100644
--- a/usr.sbin/amd/amd/util.c
+++ b/usr.sbin/amd/amd/util.c
@@ -36,7 +36,7 @@
* SUCH DAMAGE.
*
* from: @(#)util.c 8.1 (Berkeley) 6/6/93
- * $Id: util.c,v 1.1 1995/10/18 08:47:12 deraadt Exp $
+ * $Id: util.c,v 1.2 1996/08/10 21:39:43 deraadt Exp $
*/
/*
@@ -301,21 +301,13 @@ u_short *pp;
{
struct sockaddr_in sin;
int rc;
- unsigned short port;
bzero((voidp) &sin, sizeof(sin));
sin.sin_family = AF_INET;
- port = IPPORT_RESERVED;
-
- do {
- --port;
- sin.sin_port = htons(port);
- rc = bind(so, (struct sockaddr *) &sin, sizeof(sin));
- } while (rc < 0 && port > IPPORT_RESERVED/2);
-
+ rc = bindresvport(so, &sin);
if (pp && rc == 0)
- *pp = port;
+ *pp = ntohs(sin.sin_port);
return rc;
}