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



commit 79f4ac6d6f2ece80928ef08627e0e98e841b99ea
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.

 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]