gsocket: fix g_socket_details_from_fd() on Solaris
authorDan Winship <danw@gnome.org>
Sat, 3 Sep 2011 23:14:16 +0000 (19:14 -0400)
committerDan Winship <danw@gnome.org>
Sat, 3 Sep 2011 23:58:40 +0000 (19:58 -0400)
commitaf2a905e5480bc7eb82e7a43ef7fead7b3b90dd7
treebf678694b4bf9ebd46e303483f3e9b050c36d0fd
parent0d637931299f254e1b9a2cdb2d4e050b157ec8d9
gsocket: fix g_socket_details_from_fd() on Solaris

On Solaris, getsockname() on an unconnected socket gives an addrlen of
0 and doesn't set the sockaddr. So use the SO_DOMAIN sockopt to find
the socket family in that case. (SO_DOMAIN doesn't exist everywhere,
so we can't use it unconditionally. Also, we have to only use it if
getsockname() fails, since SO_DOMAIN returns a bogus value for
accept()ed sockets on both Linux and Solaris...)
gio/gsocket.c