[glib/wip/netlink-monitor-cleanups: 2/5] gnetworkmonitornetlink: Don't check if a passed-in GError ** is NULL



commit 986bb0372eb0ad22902dccb2a09a878a18a8b957
Author: Iain Lane <iainl gnome org>
Date:   Mon Sep 10 11:58:08 2018 +0100

    gnetworkmonitornetlink: Don't check if a passed-in GError ** is NULL
    
    This is not a correct way to check if `g_socket_new_from_fd()` failed.
    Instead just see if it returned `NULL` itself.
    
    This was preventing the netlink monitor from being initialised.
    
    Closes #1518

 gio/gnetworkmonitornetlink.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
---
diff --git a/gio/gnetworkmonitornetlink.c b/gio/gnetworkmonitornetlink.c
index b308b3b65..f889a3b64 100644
--- a/gio/gnetworkmonitornetlink.c
+++ b/gio/gnetworkmonitornetlink.c
@@ -113,7 +113,7 @@ g_network_monitor_netlink_initable_init (GInitable     *initable,
     }
 
   nl->priv->sock = g_socket_new_from_fd (sockfd, error);
-  if (error)
+  if (!nl->priv->sock)
     {
       g_prefix_error (error, "%s", _("Could not create network monitor: "));
       (void) g_close (sockfd, NULL);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]