]> git.ipfire.org Git - thirdparty/man-pages.git/commitdiff
rtnetlink.3: Fix example code, rta_len assignment should use RTA_LENGTH()
authorKirill Brilliantov <brilliantov@inbox.ru>
Sat, 24 Mar 2012 00:09:01 +0000 (13:09 +1300)
committerMichael Kerrisk <mtk.manpages@gmail.com>
Sat, 24 Mar 2012 00:09:01 +0000 (13:09 +1300)
See also http://bugs.debian.org/655088

Reported-by: Sergei Zhirikov <sfzhi@yahoo.com>
Signed-off-by: Michael Kerrisk <mtk.manpages@gmail.com>
man3/rtnetlink.3

index 29d7765aee62a67d730d9eca007c143e936a40a4..027f668e43ada2f8ad641bb17561e0ce423695fb 100644 (file)
@@ -4,7 +4,7 @@
 .\" and in case of nontrivial modification author and date
 .\" of the modification is added to the header.
 .\" $Id: rtnetlink.3,v 1.2 1999/05/18 10:35:10 freitag Exp $
-.TH RTNETLINK 3 2010-01-11 "GNU" "Linux Programmer's Manual"
+.TH RTNETLINK 3 2012-03-24 "GNU" "Linux Programmer's Manual"
 .SH NAME
 rtnetlink \- macros to manipulate rtnetlink messages
 .SH SYNOPSIS
@@ -109,7 +109,7 @@ Creating a rtnetlink message to set the MTU of a device:
     rta = (struct rtattr *)(((char *) &req) +
                              NLMSG_ALIGN(req.nh.nlmsg_len));
     rta\->rta_type = IFLA_MTU;
-    rta\->rta_len = sizeof(unsigned int);
+    rta\->rta_len = RTA_LENGTH(sizeof(unsigned int));
     req.n.nlmsg_len = NLMSG_ALIGN(req.nh.nlmsg_len) +
                                   RTA_LENGTH(sizeof(mtu));
     memcpy(RTA_DATA(rta), &mtu, sizeof(mtu));