From f8afba91cf8bf8f8324c3c88b8c368e7c2bd5894 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Thu, 15 Apr 1999 13:54:57 +0000 Subject: Update. * Versions.def: Add GLIBC_2.1.1 to libpthread. * iconvdata/Makefile (modules): Add KOI8-U. (distribute): Add koi8-u.c. (gen-8bit-gap-modules): Add koi8-u. * iconvdata/gconv-modules: Add KOI8-U entries. * iconvdata/koi8-u.c: New file. 1999-04-13 Thorsten Kukuk * sunrpc/auth_des.c: 64bit fixes, security fixes. * sunrpc/auth_none.c: Pretty print. * sunrpc/auth_unix.c: Likewise. * sunrpc/authdes_prot.c: Likewise. * sunrpc/authuxprot.c: Likewise. * sunrpc/bindrsvprt.c: Likewise. * sunrpc/clnt_gen.c: Likewise. * sunrpc/rpc/xdr.h: Likewise. * sunrpc/rpc/auth_des.h: Add rpc_timeval struct. * sunrpc/rpc_cmsg.c: Don't use *long pointers. * sunrpc/rtime.c: Use new rpc_timeval. * sunrpc/svc_authux.c: Don't use *long pointers. * sunrpc/svcauth_des.c: Likewise + security fixes. * sunrpc/xdr_mem.c: Don't use *long pointers. * sunrpc/xdr_rec.c: Likewise. * sunrpc/xdr_sizeof.c: Likewise. * sunrpc/xdr_stdio.c: Likewise. 1999-04-15 Ulrich Drepper --- sunrpc/bindrsvprt.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) (limited to 'sunrpc/bindrsvprt.c') diff --git a/sunrpc/bindrsvprt.c b/sunrpc/bindrsvprt.c index f646ffda70..0acfd69e09 100644 --- a/sunrpc/bindrsvprt.c +++ b/sunrpc/bindrsvprt.c @@ -26,17 +26,14 @@ * 2550 Garcia Avenue * Mountain View, California 94043 */ -#if !defined(lint) && defined(SCCSIDS) -static char sccsid[] = "@(#)bindresvport.c 2.2 88/07/29 4.0 RPCSRC 1.8 88/02/08 SMI"; -#endif /* * Copyright (c) 1987 by Sun Microsystems, Inc. */ +#include #include #include #include -#include #include #include @@ -49,9 +46,6 @@ bindresvport (int sd, struct sockaddr_in *sin) int res; static short port; struct sockaddr_in myaddr; -#ifndef errno - extern int errno; -#endif int i; #define STARTPORT 600 @@ -69,13 +63,15 @@ bindresvport (int sd, struct sockaddr_in *sin) __set_errno (EPFNOSUPPORT); return -1; } + if (port == 0) { port = (__getpid () % NPORTS) + STARTPORT; } res = -1; __set_errno (EADDRINUSE); - for (i = 0; i < NPORTS && res < 0 && errno == EADDRINUSE; i++) + + for (i = 0; i < NPORTS && res < 0 && errno == EADDRINUSE; ++i) { sin->sin_port = htons (port++); if (port > ENDPORT) @@ -84,5 +80,6 @@ bindresvport (int sd, struct sockaddr_in *sin) } res = bind (sd, sin, sizeof (struct sockaddr_in)); } + return res; } -- cgit v1.2.3