On Mon, Jul 17, 2017 at 11:07:43PM +0800, JingPiao Chen wrote: > * netlink.c: Include "xlat/netlink_ack_flags.h". > (decode_nlmsg_flags): Decode ack flags when type == NLMSG_ERROR. > * xlat/netlink_ack_flags.in: New file. > * tests/netlink_protocol.c (test_ack_flags): New function, check this. > (main): Use it. > --- > netlink.c | 5 +++++ > tests/netlink_protocol.c | 42 ++++++++++++++++++++++++++++++++++++++++++ > xlat/netlink_ack_flags.in | 2 ++ > 3 files changed, 49 insertions(+) > create mode 100644 xlat/netlink_ack_flags.in > > diff --git a/netlink.c b/netlink.c > index e054ae3..9d480d3 100644 > --- a/netlink.c > +++ b/netlink.c > @@ -32,6 +32,7 @@ > #include <linux/audit.h> > #include <linux/rtnetlink.h> > #include <linux/xfrm.h> > +#include "xlat/netlink_ack_flags.h" > #include "xlat/netlink_flags.h" > #include "xlat/netlink_get_flags.h" > #include "xlat/netlink_new_flags.h" > @@ -198,6 +199,10 @@ decode_nlmsg_flags(const uint16_t flags, const uint16_t > type, const int family) > > if (type == NLMSG_DONE) > goto end; > + if (type == NLMSG_ERROR) { > + table = netlink_ack_flags; > + goto end; > + }
Two subsequent "if" statements of this kind would look better as a "switch" statement. If there is no need to handle family-specific control messages in decode_nlmsg_flags, a more appropriate alternative might be if (type < NLMSG_MIN_TYPE) { if (type == NLMSG_ERROR) table = netlink_ack_flags; goto end; } -- ldv
signature.asc
Description: PGP signature
------------------------------------------------------------------------------ Check out the vibrant tech community on one of the world's most engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel