----- Forwarded message from Ulrich Drepper <drepper@xxxxxxxxxx> -----
> Any other suggestions ?
Get the kernel people to handle this. I have no idea why they write
in the rest of the structure.
----- End forwarded message -----
ok, so I'm asking:
struct sockaddr_storage ss;
memset(&ss, 0, sizeof(ss));
(gdb) print *(struct sockaddr_in *)&ss
$4 = {sin_family = 0, sin_port = 0, sin_addr = {s_addr = 0},
sin_zero = "\000\000\000\000\000\000\000"}
getpeername(s, (struct sockaddr *)&ss, &length);
(gdb) print *(struct sockaddr_in *)&ss
$4 = {sin_family = 2, sin_port = 5888, sin_addr = {s_addr = 16820416},
sin_zero = "š\221\020ŔźCĽÁ"}
and kernel put's garbage into rest of ss (sin_zero) instead
leaving it alone.
This is bad thing because we can't memcmp() two structs
to check if adresses, families and ports are equal.
Can someone fix this ?
--
Arkadiusz Miśkiewicz http://www.misiek.eu.org/
PLD GNU/Linux [IPv6 enabled] http://www.pld.org.pl/
|