Bsd sockets and GCC 4.0
Bsd sockets and GCC 4.0
- Subject: Bsd sockets and GCC 4.0
- From: Ryan Lum <email@hidden>
- Date: Mon, 16 May 2005 16:39:16 -0500
I have some code that is over 10 years old. With the recent change to GCC
4.0 my socket code won't compile anymore. The only way I can compile my
code is if I use gcc_select. The problem is with the bind() call.
First, though I was getting strange compiler warnings.
comm.c: In function 'co1900_new_connection':
comm.c:1798: warning: pointer targets in passing argument 3 of 'getsockname'
differ in signedness
comm.c:1804: warning: pointer targets in passing argument 3 of 'accept'
differ in signedness
comm.c: In function 'co2000_new_descriptor':
comm.c:1863: warning: pointer targets in passing argument 3 of 'getpeername'
differ in signedness
1789: getsockname(s, (struct sockaddr *)&isa, &i);
1804: t = accept(s, (struct sockaddr *)&isa, &i);
1863: rc = getpeername(desc, (struct sockaddr *) &sock, &size);
I fixed the warnings by making (i) an unsigned int.
The bind code I am having a problem with is:
if(bind(s, (struct sockaddr *)&sa, sizeof(sa) < 0)) {
With gcc 3.3 no problems, but it is returning -1 with 4.0. I am no socket
expert, and any debugging advice would help.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden