chiark / gitweb /
sd-netlink: turn 'max' into 'count' to support empty type-systems
[elogind.git] / src / libsystemd / sd-netlink / netlink-message.c
index e39e4c646c5cded12b41078afb6453a61704a92b..bfbc0e6c95d63afc1cf20d582ae3db344e232a80 100644 (file)
@@ -72,9 +72,6 @@ int message_new(sd_netlink *rtnl, sd_netlink_message **ret, uint16_t type) {
         if (r < 0)
                 return r;
 
-        if (type_get_type(nl_type) != NETLINK_TYPE_NESTED)
-                return -EINVAL;
-
         r = message_new_empty(rtnl, &m);
         if (r < 0)
                 return r;
@@ -88,7 +85,8 @@ int message_new(sd_netlink *rtnl, sd_netlink_message **ret, uint16_t type) {
 
         m->hdr->nlmsg_flags = NLM_F_REQUEST | NLM_F_ACK;
 
-        type_get_type_system(nl_type, &m->container_type_system[0]);
+        if (type_get_type(nl_type) == NETLINK_TYPE_NESTED)
+                type_get_type_system(nl_type, &m->container_type_system[0]);
         m->hdr->nlmsg_len = size;
         m->hdr->nlmsg_type = type;