Blame SOURCES/python-ethtool-0.8-check-libnl-return-codes.patch

69c2f9
--- a/python-ethtool/etherinfo.c.orig	2014-01-13 13:38:58.716919961 +0100
69c2f9
+++ b/python-ethtool/etherinfo.c	2014-01-13 13:52:15.838033480 +0100
69c2f9
@@ -327,6 +327,9 @@
69c2f9
 	 */
69c2f9
 	if( ethinf->index < 0 ) {
69c2f9
 		link_cache = rtnl_link_alloc_cache(*data->nlc);
69c2f9
+        if( link_cache == NULL ) {
69c2f9
+            return 0;
69c2f9
+        }
69c2f9
 		ethinf->index = rtnl_link_name2i(link_cache, ethinf->device);
69c2f9
 		if( ethinf->index < 0 ) {
69c2f9
 			return 0;
69c2f9
@@ -339,6 +342,9 @@
69c2f9
 	case NLQRY_LINK:
69c2f9
 		/* Extract MAC/hardware address of the interface */
69c2f9
 		link_cache = rtnl_link_alloc_cache(*data->nlc);
69c2f9
+        if( link_cache == NULL ) {
69c2f9
+            return 0;
69c2f9
+        }
69c2f9
 		link = rtnl_link_alloc();
69c2f9
 		rtnl_link_set_ifindex(link, ethinf->index);
69c2f9
 		nl_cache_foreach_filter(link_cache, (struct nl_object *)link, callback_nl_link, ethinf);
69c2f9
@@ -350,7 +356,14 @@
69c2f9
 	case NLQRY_ADDR:
69c2f9
 		/* Extract IP address information */
69c2f9
 		addr_cache = rtnl_addr_alloc_cache(*data->nlc);
69c2f9
+        if( addr_cache == NULL ) {
69c2f9
+            return 0;
69c2f9
+        }
69c2f9
 		addr = rtnl_addr_alloc();
69c2f9
+        if( addr == NULL ) {
69c2f9
+            nl_cache_free(addr_cache);
69c2f9
+            return 0;
69c2f9
+        }
69c2f9
 		rtnl_addr_set_ifindex(addr, ethinf->index);
69c2f9
 
69c2f9
                 /* Make sure we don't have any old IPv6 addresses saved */
69c2f9
@@ -409,7 +422,9 @@
69c2f9
 
69c2f9
 	/* No earlier connections exists, establish a new one */
69c2f9
 	*data->nlc = nl_handle_alloc();
69c2f9
-	nl_connect(*data->nlc, NETLINK_ROUTE);
69c2f9
+	if( nl_connect(*data->nlc, NETLINK_ROUTE) != 0 ) {
69c2f9
+        return 0;
69c2f9
+    }
69c2f9
 	if( (*data->nlc != NULL) ) {
69c2f9
 		/* Force O_CLOEXEC flag on the NETLINK socket */
69c2f9
 		if( fcntl(nl_socket_get_fd(*data->nlc), F_SETFD, FD_CLOEXEC) == -1 ) {