do_tcmonitor() opens its own handle in a local named rth, shadowing the global declared in tc_common.h; rename it to mrth. route_print_opt() invokes SPRINT_BUF(b1) twice in the same function and print_pedit() redeclares int err while the enclosing one is not yet live; drop the inner declarations. Signed-off-by: Stephen Hemminger <step…@networkplumber.org> --- tc/f_route.c | 1 - tc/m_pedit.c | 2 -- tc/tc_monitor.c | 12 ++++++------ 3 files changed, 6 insertions(+), 9 deletions(-) diff --git a/tc/f_route.c b/tc/f_route.c index c234ddf0..be313784 100644 --- a/tc/f_route.c +++ b/tc/f_route.c @@ -150,7 +150,6 @@ static int route_print_opt(const struct filter_util *qu, FILE *f, struct rtattr print_uint(PRINT_ANY, "order", "order %d ", (handle >> 8) & 0x7F); if (tb[TCA_ROUTE4_CLASSID]) { - SPRINT_BUF(b1); print_string(PRINT_ANY, "flowid", "flowid %s ", sprint_tc_classid(rta_getattr_u32(tb[TCA_ROUTE4_CLASSID]), b1)); } diff --git a/tc/m_pedit.c b/tc/m_pedit.c index 040d6168..07360c04 100644 --- a/tc/m_pedit.c +++ b/tc/m_pedit.c @@ -766,8 +766,6 @@ static int print_pedit(const struct action_util *au, FILE *f, struct rtattr *arg if (tb[TCA_PEDIT_PARMS]) { sel = RTA_DATA(tb[TCA_PEDIT_PARMS]); } else { - int err; - sel = RTA_DATA(tb[TCA_PEDIT_PARMS_EX]); if (!tb[TCA_PEDIT_KEYS_EX]) { diff --git a/tc/tc_monitor.c b/tc/tc_monitor.c index 5b9bccbe..fdbe6e4e 100644 --- a/tc/tc_monitor.c +++ b/tc/tc_monitor.c @@ -67,7 +67,7 @@ static int accept_tcmsg(struct rtnl_ctrl_data *ctrl, int do_tcmonitor(int argc, char **argv) { - struct rtnl_handle rth; + struct rtnl_handle mrth; char *file = NULL; unsigned int groups = nl_mgrp(RTNLGRP_TC); @@ -100,16 +100,16 @@ int do_tcmonitor(int argc, char **argv) return ret; } - if (rtnl_open(&rth, groups) < 0) + if (rtnl_open(&mrth, groups) < 0) exit(1); - ll_init_map(&rth); + ll_init_map(&mrth); - if (rtnl_listen(&rth, accept_tcmsg, (void *)stdout) < 0) { - rtnl_close(&rth); + if (rtnl_listen(&mrth, accept_tcmsg, (void *)stdout) < 0) { + rtnl_close(&mrth); exit(2); } - rtnl_close(&rth); + rtnl_close(&mrth); exit(0); }
-- 2.53.0