C warning that I can't seem to track down

bob ican-rZHaEmXdJNJWk0Htik3J/w at public.gmane.org
Tue Aug 8 16:11:37 UTC 2006


Of course.    I'll try that once I get back to my system with the newer GCC 
installed.

Thanks.

bob
PS.
Still can't believe how obtuse the Linux headers have become since I last 
looked in any detail.    Maybe Google can tell me where socklen_t is actually 
defined ... 


On Tuesday 08 August 2006 09:51 am, Alex Beamish wrote:
> On 8/8/06, bob <ican-rZHaEmXdJNJWk0Htik3J/w at public.gmane.org> wrote:
> > In newer versions of the GCC compiler the block of C code:
> >
> > int length;
> >
> > ...
> >
> > if(getsockname(s, (struct sockaddr *)&sin, &length))
> >
> > gives a warning below
> >
> > socketUtils.c:259: warning: pointer targets in passing argument 3 of
> > 'getsockname' differ in signedness
>
> Hi Bob,
>
> Google tells me at
>
>
> http://www.penguin-soft.com/penguin/man/2/getsockname.html?manpath=/man/man
>2/getsockname.2.inc
>
> that getsockname has the following prototype:
>
>   int getsockname(int s , struct sockaddr * name , socklen_t * namelen );
>
> so you need to cast length to a pointer to socklen_t, even if that works
> out to an int in the end. Change your line to
>
>   if(getsockname(s, (struct sockaddr *)&sin, (socklen_t *)&length))
>
> and re-compile. Let us know how it all works.
>
> I tracked it down to a define called "socklen_t".    Damned if I can find
>
> > where that is defined.
>
> Google is your friend. :)
--
The Toronto Linux Users Group.      Meetings: http://tlug.ss.org
TLUG requests: Linux topics, No HTML, wrap text below 80 columns
How to UNSUBSCRIBE: http://tlug.ss.org/subscribe.shtml





More information about the Legacy mailing list