summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Müllner <fmuellner@gnome.org>2018-09-13 12:45:11 +0200
committerFlorian Müllner <fmuellner@gnome.org>2018-09-13 14:44:13 +0200
commite8c0754d6ca0114aa77d10b2ad1bdcde4d26e7fb (patch)
tree9bcff42deaeead2bbcb2e6860655160565c37516
parent5bc35a72459e3413bb096a167a3931a7e3af227d (diff)
downloadglib-wip/fmuellner/fix-netmonitor.tar.gz
networkmonitor netlink: Fix error detectionwip/fmuellner/fix-netmonitor
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
-rw-r--r--gio/gnetworkmonitornetlink.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/gio/gnetworkmonitornetlink.c b/gio/gnetworkmonitornetlink.c
index b308b3b65..493ddefb6 100644
--- a/gio/gnetworkmonitornetlink.c
+++ b/gio/gnetworkmonitornetlink.c
@@ -113,9 +113,10 @@ g_network_monitor_netlink_initable_init (GInitable *initable,
}
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);
return FALSE;
}