chiark / gitweb /
sd-netlink: don't treat type_system->count==0 as invalid
authorDavid Herrmann <dh.herrmann@gmail.com>
Tue, 23 Jun 2015 10:03:10 +0000 (12:03 +0200)
committerSven Eden <yamakuzure@gmx.net>
Tue, 14 Mar 2017 09:04:18 +0000 (10:04 +0100)
Empty type-systems are just fine. Avoid the nasty hack in
union-type-systems that treat empty type-systems as invalid. Instead check
for the actual types-array and make sure it's non-NULL (which is even true
for empty type-systems, due to "empty_types" array).

src/libsystemd/sd-netlink/netlink-types.c

index c4573b6090d11e7d425a8fde22ce23f9b6981d08..d22194ad717f7a06d7861716e46e69c62875695f 100644 (file)
@@ -598,7 +598,7 @@ int type_system_union_protocol_get_type_system(const NLTypeSystemUnion *type_sys
                 return -EOPNOTSUPP;
 
         type_system = &type_system_union->type_systems[protocol];
-        if (type_system->count == 0)
+        if (!type_system->types)
                 return -EOPNOTSUPP;
 
         *ret = type_system;