Re: [PATCH] getsockname() always fails with EFAULT in 2.1.127pre7

David S. Miller (davem@dm.cobaltmicro.com)
Fri, 6 Nov 1998 21:09:38 -0800


Fix your code:

if (getsockname(sock_descriptor, (struct sockaddr *)&sock_address, (socklen_t*)sizeof(struct sockaddr_in))==-1)

No way this doesn't work, try:

socklen_t tmp = sizeof(struct sockaddr_in);
if (getsockname(sock_descriptor, (struct sockaddr *)&sock_address, &tmp)==-1)

Later,
David S. Miller
davem@dm.cobaltmicro.com

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/