getsockname(2) doesn't work if socket isn't connected
|Reported by:||leorize||Owned by:||axeld|
|Component:||Network & Internet/Stack||Version:||R1/Development|
According to POSIX, getsockname is meant to "retrieve the locally-bound name of the specified socket", so it shouldn't fail if the socket is not connected.
Attached below is a toy program that describe this issue
How to run:
$ gcc -o sock sock.c -lnetwork $ ./sock
getsockname: Socket is not connected