Nmap Development mailing list archives

Re: Can't compile nmap v4.03 in Mac OS X 10.2.8


From: Andreas Ericsson <ae () op5 se>
Date: Wed, 03 Jan 2007 13:28:23 +0100

Kurt Grutzmacher wrote:
On 12/23/06, Phillip Pi <ant () zimage com> wrote:

FYI. I can't compile v4.20 as well: http://pastebin.ca/289686


Delving deeper into google searches tells me that OSX 10.2.8 doesn't have
socklen_t defined correctly. Try this patch, it seems to compile and run
cleanly on my OSX 10.4.8 and linux 2.6 platforms but since I'm checking for
socklen_t to be defined it may have issues on other platforms (if it's
defined somewhere else that I've missed).

It's a patch against configure.ac so you may need to do an "autoconf" in 
the
nsock/src directory. Make should take care of this but you never know.


Checking for (and using) socklen_t is unnecessary. It will never change 
from being exactly the same as int.

 From the accept(3) man-page:

The  third  argument  of accept() was originally declared as an ‘int *’
(and is that under libc4 and libc5 and on many other systems  like  4.x
BSD,  SunOS 4, SGI); a POSIX 1003.1g draft standard wanted to change it
into a ‘size_t *’, and that is what it is for  SunOS  5.   Later  POSIX
drafts  have ‘socklen_t *’, and so do the Single Unix Specification and
glibc2.  Quoting Linus Torvalds:

"_Any_ sane library _must_ have "socklen_t" be the same  size  as  int.
Anything else breaks any BSD socket layer stuff.  POSIX initially _did_
make it a size_t, and I (and hopefully others, but  obviously  not  too
many)  complained  to  them  very loudly indeed.  Making it a size_t is
completely broken, exactly because size_t very seldom is the same  size
as  "int" on 64-bit architectures, for example.  And it _has_ to be the
same size as "int" because that’s what the  BSD  socket  interface  is.
Anyway,   the   POSIX   people  eventually  got  a  clue,  and  created
"socklen_t".  They shouldn’t have touched it in the  first  place,  but
once  they  did  they felt it had to have a named type for some unfath-
omable reason (probably somebody didn’t like losing  face  over  having
done  the  original  stupid  thing, so they silently just renamed their
blunder)."

-- 
Andreas Ericsson                   andreas.ericsson () op5 se
OP5 AB                             www.op5.se
Tel: +46 8-230225                  Fax: +46 8-230231

_______________________________________________
Sent through the nmap-dev mailing list
http://cgi.insecure.org/mailman/listinfo/nmap-dev
Archived at http://SecLists.Org

Current thread: