Path: utzoo!attcan!uunet!aplcen!haven!adm!news From: stanonik@nprdc.navy.mil (Ron Stanonik) Newsgroups: comp.unix.wizards Subject: Re: Re: socket bound? Message-ID: <23668@adm.BRL.MIL> Date: 15 Jun 90 13:50:25 GMT Sender: news@adm.BRL.MIL Lines: 25 "Seriously, what are you trying to do?" The problem is that I'm using a library routine (clntudp_bufcreate in sun's yp/nis library) which returns a socket. The routine apparently attempts to bind the socket to a priviledged (< 1024) port. Because of this undocumented "feature", if the user is root, then the socket returned is already bound and any attempt by the user to bind it will fail. Ah, you exclaim, check errno and if it indicates "already bound", then ignore the error. The errno, EINVAL, can mean "already bound" OR it can mean "namelen is wrong", in sunos4.X. True, I can probably assume that namelen is okay, since I code flawlessly. :-) If sun hadn't overloaded EINVAL, then checking errno would unquestionably be the solution. My question about unbinding a socket was just idle curiousity spurred by trying to deal with this "is it bound or is it not" problem. Thanks, Ron stanonik@nprdc.navy.mil