]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
rtnetlink.3: Use sizeof consistently
authorAlejandro Colomar <colomar.6.4.3@gmail.com>
Thu, 3 Sep 2020 19:55:00 +0000 (21:55 +0200)
committerMichael Kerrisk <mtk.manpages@gmail.com>
Sat, 5 Sep 2020 12:49:42 +0000 (14:49 +0200)
Use ``sizeof`` consistently through all the examples in the following
way:

- Use the name of the variable instead of its type as argument for
  ``sizeof``.

Rationale:
https://www.kernel.org/doc/html/v5.8/process/coding-style.html#allocating-memory

Signed-off-by: Alejandro Colomar <colomar.6.4.3@gmail.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
man3/rtnetlink.3

index 07bb1fbf96c9601ab9c6001de9d177d30270040b..2d9fa05a2a7163fc4dfb5c2ace1e12e0e34eb014 100644 (file)
@@ -105,7 +105,7 @@ unsigned int mtu = 1000;
 int rtnetlink_sk = socket(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE);
 
 memset(&req, 0, sizeof(req));
-req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(struct ifinfomsg));
+req.nh.nlmsg_len = NLMSG_LENGTH(sizeof(req.if));
 req.nh.nlmsg_flags = NLM_F_REQUEST;
 req.nh.nlmsg_type = RTM_NEWLINK;
 req.if.ifi_family = AF_UNSPEC;