getsockname()

Christian Klein chris at schwer.bewaff.net
Wed Jan 7 13:52:36 PST 2004


Am Mittwoch, 07.01.04, um 22:40 Uhr (Europe/Berlin) schrieb David 
Schwartz:
>
> 	Fix those two bugs and see if you still have a problem.
>
> 	DS

Ok, here's the diff of the changes:

$ diff public_html/haunted.c haunted.c
11c11
<       int sock, len;
---
 >       int sock, len=0;
36,37c36,40
<       getsockname(sock, (struct sockaddr *) &foo, &len);
<       fprintf(stderr, "listening on %s:%d\n", 
inet_ntoa(foo.sin_addr), ntohs(foo.sin_port));
---
 >       if(getsockname(sock, (struct sockaddr *) &foo, &len)<0)
 >       {
 >               perror("getsockname");
 >       } else
 >               fprintf(stderr, "listening on %s:%d\n", 
inet_ntoa(foo.sin_addr), ntohs(foo.sin_port));

But still the same :-(

(BTW, the problem does not occur on my FreeBSD-current machine)

Chris



More information about the freebsd-stable mailing list