Re: [SMAUG] signedness warnings

Re: [SMAUG] signedness warnings



On 5/11/05, PoE <averety@earthlink.net> wrote:
>  
> Hello, I recently upgraded to GCC 4.0 and now I am getting these warnings. 
>   
> ident.c: In function 'set_auth':
> ident.c:288: warning: pointer targets in passing argument 3 of 'getsockname'
> differ in signedness
> ident.c:293: warning: pointer targets in passing argument 3 of 'getpeername'
> differ in signedness 

It means probably that  getsockname()  expects a regular int
and you are passing it a pointer to an unsigned int.

getsockname() expects these arguments:

       int getsockname(int s, struct sockaddr *name, socklen_t *namelen);
                                                                      
            ^^^^^^^^^^^^^^^^^^^^

the third argument is the pointer.

if you did

unsigned int x;

getsockname(fd, nameptr, &x);

you could expect to see this...

should instead use

socklen_t x;


(It should go without saying: If you use a pointer variable, make 
sure the type of the thing it points to is the same as the pointer type)

-- 
-Mysid