Re: Bug, well not really but could be?
Mark Johnson <[email protected]>
| Newsgroups | gmane.network.djbdns |
|---|---|
| Message-ID | <[email protected]> |
On Sat, Nov 28, 2009 at 4:58 PM, Daryl Tester <[email protected]> wrote: > (* Reply to dev null'd *) > > Paul Procacci wrote: > >> I have the following definition of accept: >> >> int accept(int s, struct sockaddr * restrict addr, socklen_t * restrict >> addrlen); > > Note that the 3rd argument wasn't always socklen_t; it initially was int > (pre-Posix something). Some relevant reading material: http://portabilityblog.com/blog/archives/7-socklen_t-confusion.html I switched to socklen_t in my djbdns fork (zinq-djbdns) to avoid the compiler warnings: http://zinq.svn.sourceforge.net/viewvc/zinq?view=rev&revision=55 > Provided that the sizeof (struct sockaddr_in) remains less than 2GB in > size (which I hope so for the immediate future) there shouldn't be an > issue (too early in the morning for me to be doing signed arithmetic). In a sane world, socklen_t would always be big enough to contain the result of: sizeof sa where sa is a sockaddr_in The same goes if using an int instead of socklen_t. > Don't make the folly of applying standards of today to software that > was written nearly 10 years (or probably greater) ago. Lots of Dan's stuff (most? all?) predates the latest Posix specs. I believe he also explicitly targetted non-Posix platforms. I consider compiler warnings to be broken windows. I've gotten some of my djbware forks to compile without any on recent vintages of Linux and GCC (though I feel I had to cheat a bit to do so). I think I've got a few left in zinq-djbdns, though...