networkmonitor netlink: Fix error detection

We currently bail out of initialization if a GError has been passed
to the function, not if it has been set by the previous call.

Until recently this bug disguised errors, but since commit e0b120cc
it causes initialization to always "fail".

https://gitlab.gnome.org/GNOME/glib/issues/1523
This commit is contained in:
Florian Müllner
2018-09-13 12:45:11 +02:00
parent 5bc35a7245
commit e8c0754d6c

View File

@@ -113,9 +113,10 @@ g_network_monitor_netlink_initable_init (GInitable *initable,
} }
nl->priv->sock = g_socket_new_from_fd (sockfd, error); nl->priv->sock = g_socket_new_from_fd (sockfd, error);
if (error) if (nl->priv->sock == NULL)
{ {
g_prefix_error (error, "%s", _("Could not create network monitor: ")); if (error)
g_prefix_error (error, "%s", _("Could not create network monitor: "));
(void) g_close (sockfd, NULL); (void) g_close (sockfd, NULL);
return FALSE; return FALSE;
} }