mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-01 15:03:39 +02:00
Add GError to g_socket_address_to_native
This is nice for some callers so they can report an error. It is also required to support opional address types like abstract paths for unix domain sockets.
This commit is contained in:
@@ -133,13 +133,18 @@ g_unix_socket_address_get_native_size (GSocketAddress *address)
|
||||
static gboolean
|
||||
g_unix_socket_address_to_native (GSocketAddress *address,
|
||||
gpointer dest,
|
||||
gsize destlen)
|
||||
gsize destlen,
|
||||
GError **error)
|
||||
{
|
||||
GUnixSocketAddress *addr = G_UNIX_SOCKET_ADDRESS (address);
|
||||
struct sockaddr_un *sock;
|
||||
|
||||
if (destlen < sizeof (*sock))
|
||||
return FALSE;
|
||||
{
|
||||
g_set_error_literal (error, G_IO_ERROR, G_IO_ERROR_NO_SPACE,
|
||||
_("Not enough space for socket address"));
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
sock = (struct sockaddr_un *) dest;
|
||||
sock->sun_family = AF_UNIX;
|
||||
|
Reference in New Issue
Block a user