mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2025-08-20 15:48:54 +02:00
Always include G_SOCKET_FAMILY_UNIX value in GSocketFamily
This is needed because glib-mkenums doesn't handle #ifdef values in enums, and so it needs to have all values always defined in the enum. When not available, define the missing values to a negative value.
This commit is contained in:
@@ -687,9 +687,7 @@ typedef enum /*< flags >*/ {
|
||||
*/
|
||||
typedef enum {
|
||||
G_SOCKET_FAMILY_INVALID,
|
||||
#ifdef GLIB_SYSDEF_AF_UNIX
|
||||
G_SOCKET_FAMILY_UNIX = GLIB_SYSDEF_AF_UNIX,
|
||||
#endif
|
||||
G_SOCKET_FAMILY_IPV4 = GLIB_SYSDEF_AF_INET,
|
||||
G_SOCKET_FAMILY_IPV6 = GLIB_SYSDEF_AF_INET6
|
||||
} GSocketFamily;
|
||||
|
@@ -500,6 +500,13 @@ g_socket_create_socket (GSocketFamily family,
|
||||
g_assert_not_reached ();
|
||||
}
|
||||
|
||||
if (family < 0)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
|
||||
_("Unable to create socket: %s"), _("Unknown family was specified"));
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (protocol == -1)
|
||||
{
|
||||
g_set_error (error, G_IO_ERROR, G_IO_ERROR_INVALID_ARGUMENT,
|
||||
|
Reference in New Issue
Block a user