25 Sep, 2013, JohnnyStarr wrote in the 1st comment:
Votes: 0
I'm getting the following warnings in init_descriptor() in comm.c
I have had quite a few complaints from GCC but I've been able to clean everything up until now. Here is the output I'm getting:
comm.c: In function init_descriptor: comm.c:933:35: warning: passing argument 3 of getsockname from incompatible pointer type [enabled by default] /usr/include/x86_64-linux-gnu/sys/socket.h:119:12: note: expected socklen_t * __restrict__ but argument is of type size_t * comm.c:934:42: warning: passing argument 3 of accept from incompatible pointer type [enabled by default] /usr/include/x86_64-linux-gnu/sys/socket.h:214:12: note: expected socklen_t * __restrict__ but argument is of type size_t * comm.c:970:36: warning: passing argument 3 of getpeername from incompatible pointer type [enabled by default] /usr/include/x86_64-linux-gnu/sys/socket.h:133:12: note: expected socklen_t * __restrict__ but argument is of type size_t *
For convenience, here is the init_descriptor() function in full. I have also commented the line numbers that are throwing the warnings.
size = sizeof (sock); if (getpeername (desc, (struct sockaddr *) &sock, &size) < 0) // ========== LN: 970 { perror ("New_descriptor: getpeername"); dnew->host = str_dup ("(unknown)"); } else { /* * Would be nice to use inet_ntoa here but it takes a struct arg, * which ain't very compatible between gcc and system libraries. */ int addr;
/* * Swiftest: I added the following to ban sites. I don't * endorse banning of sites, but Copper has few descriptors now * and some people from certain sites keep abusing access by * using automated 'autodialers' and leaving connections hanging. * * Furey: added suffix check by request of Nickel of HiddenWorlds. */ if (check_ban (dnew->host, BAN_ALL)) { write_to_descriptor (desc, "Your site has been banned from this mud.\n\r", 0); close (desc); free_descriptor (dnew); return; } /* * Init descriptor data. */ dnew->next = descriptor_list; descriptor_list = dnew;
/* * First Contact! */ if (!mud_ansiprompt) { extern char * help_greeting; if ( help_greeting[0] == '.' ) send_to_desc ( help_greeting+1, dnew ); else send_to_desc ( help_greeting , dnew ); } else send_to_desc ("Do you want ANSI? (Y/n) ", dnew);
I have had quite a few complaints from GCC but I've been able to clean everything up until now.
Here is the output I'm getting:
For convenience, here is the init_descriptor() function in full. I have also commented the line numbers that are throwing the warnings.
Any help here would be appreciated. Thanks.