Article View: news.software.nntp
Article #35422Re: nnrpd daemon (-D) mode fixes
From: Forrest J. Cavalier III
Date: Sat, 13 Feb 1999 00:00
Date: Sat, 13 Feb 1999 00:00
39 lines
2447 bytes
2447 bytes
In article <7a1t47$8rka$1@newssvr04-int.news.prodigy.com>, davidsen@tmr.com wrote... > >In article <79t2ms$iil$1@news1.epix.net>, >Forrest J. Cavalier III <mibsoft@mibsoftware.com> wrote: > >| Bill, your "corrected" code fails if a sizeof(sockaddr_in) is >| larger than sizeof(sockaddr). (What should happen is that >| accept() would see a wrong length member and return an error.) > >Then perhaps the prototype is wrong, since it requires sockaddr. If so, >it's wrong on a LOT of systems... which is why I assumed that the >prototype was correct and the source was wrong. If that's the case it's >wrong on at least Linux, BSD, SCO and AIX, I checked there before I >changed it. No. That is the point you are missing. You can't change the prototype to sockaddr_in, because it also takes takes sockaddr_un, and other types, depending on what protocol family was used to create the listen socket. The system can differentiate. Perhaps you (and your compiler) would have liked it better if the prototype took a (void *), but that is much less descriptive documentation. Or perhaps you would have liked to see separate functions. accept_in(), accept_un(), accept_iso() for each socket type. Regardless of what you would have liked, the convention is set that one function is enough to handle different structure types passed to it. One type of structure is not adequate for all protocol families. (See the socket() man page... http://www.mibsoftware.com/reuse/cfn/man2/socket.2.htm for protocol families.) You should NEVER declare an object of sockaddr. You must use one of the protocol specific versions. Forrest
Technical Details
Message-ID:
<7a3vcs$40f$1@news1.epix.net>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mailReferences:
<79eufj$7nh0$1@newssvr04-int.news.prodigy.com> <873e4kprj6.fsf@erlenstar.demon.co.uk> <79smvr$7ni8$1@newssvr04-int.news.prodigy.com> <79t2ms$iil$1@news1.epix.net> <7a1t47$8rka$1@newssvr04-int.news.prodigy.com>Show Full Headers
Complete Article Headers
Message-ID: <7a3vcs$40f$1@news1.epix.net> Subject: Re: nnrpd daemon (-D) mode fixes Date: Sat, 13 Feb 1999 00:00:00 +0000 From: mibsoft@mibsoftware.com (Forrest J. Cavalier III) References: <79eufj$7nh0$1@newssvr04-int.news.prodigy.com> <873e4kprj6.fsf@erlenstar.demon.co.uk> <79smvr$7ni8$1@newssvr04-int.news.prodigy.com> <79t2ms$iil$1@news1.epix.net> <7a1t47$8rka$1@newssvr04-int.news.prodigy.com> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.nntp.mbox.zip!not-for-mail X-Deja-AN: 443959793 Content-Type: Text/Plain; charset=US-ASCII Organization: Mib Software Mime-Version: 1.0 Newsgroups: news.software.nntp