summaryrefslogtreecommitdiffstats
path: root/lib/libc/net/rcmd.c
diff options
context:
space:
mode:
authorderaadt <deraadt@openbsd.org>1999-12-16 21:30:34 +0000
committerderaadt <deraadt@openbsd.org>1999-12-16 21:30:34 +0000
commit01cdefb0b166a1bdd89a4e18f2de1c94e537891f (patch)
treee887bf2a06f874302eb057b18e3fb0ef0971c546 /lib/libc/net/rcmd.c
parentBugfix: execvp might fail for many reasons. (diff)
downloadwireguard-openbsd-01cdefb0b166a1bdd89a4e18f2de1c94e537891f.tar.xz
wireguard-openbsd-01cdefb0b166a1bdd89a4e18f2de1c94e537891f.zip
rresvport_af() and bindresvport_af()
Diffstat (limited to 'lib/libc/net/rcmd.c')
-rw-r--r--lib/libc/net/rcmd.c34
1 files changed, 1 insertions, 33 deletions
diff --git a/lib/libc/net/rcmd.c b/lib/libc/net/rcmd.c
index c933f5b4475..bd920faadb5 100644
--- a/lib/libc/net/rcmd.c
+++ b/lib/libc/net/rcmd.c
@@ -34,7 +34,7 @@
*/
#if defined(LIBC_SCCS) && !defined(lint)
-static char *rcsid = "$OpenBSD: rcmd.c,v 1.31 1998/03/19 00:30:05 millert Exp $";
+static char *rcsid = "$OpenBSD: rcmd.c,v 1.32 1999/12/16 21:30:34 deraadt Exp $";
#endif /* LIBC_SCCS and not lint */
#include <sys/param.h>
@@ -253,38 +253,6 @@ bad:
return (-1);
}
-int
-rresvport(alport)
- int *alport;
-{
- struct sockaddr_in sin;
- int s;
-
- bzero(&sin, sizeof sin);
- sin.sin_len = sizeof(struct sockaddr_in);
- sin.sin_family = AF_INET;
- sin.sin_addr.s_addr = INADDR_ANY;
- s = socket(AF_INET, SOCK_STREAM, 0);
- if (s < 0)
- return (-1);
- sin.sin_port = htons((in_port_t)*alport);
- if (*alport < IPPORT_RESERVED - 1) {
- if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) >= 0)
- return (s);
- if (errno != EADDRINUSE) {
- (void)close(s);
- return (-1);
- }
- }
- sin.sin_port = 0;
- if (bindresvport(s, &sin) == -1) {
- (void)close(s);
- return (-1);
- }
- *alport = (int)ntohs(sin.sin_port);
- return (s);
-}
-
int __check_rhosts_file = 1;
char *__rcmd_errstr;