• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Bsd sockets and GCC 4.0
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Bsd sockets and GCC 4.0


  • Subject: Re: Bsd sockets and GCC 4.0
  • From: Josh Graessley <email@hidden>
  • Date: Mon, 16 May 2005 14:45:56 -0700


On May 16, 2005, at 2:39 PM, Ryan Lum wrote:

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.

When you get -1 as the return value, what is errno set to?

-josh

Attachment: smime.p7s
Description: S/MIME cryptographic signature

 _______________________________________________
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

References: 
 >Bsd sockets and GCC 4.0 (From: Ryan Lum <email@hidden>)

  • Prev by Date: Re: Bsd sockets and GCC 4.0
  • Next by Date: Re: Bsd sockets and GCC 4.0
  • Previous by thread: Re: Bsd sockets and GCC 4.0
  • Next by thread: Re: Bsd sockets and GCC 4.0
  • Index(es):
    • Date
    • Thread