]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - tc/m_pedit.c
tc: Remove pointless assignments in batch()
[mirror_iproute2.git] / tc / m_pedit.c
index dc57f14ae1ce5fae75052d04115eb6e7cef7e07a..2aeb56d9615f1e9ee4029aa5280c7170fe95e730 100644 (file)
@@ -111,7 +111,7 @@ reg:
 noexist:
        p = calloc(1, sizeof(*p));
        if (p) {
-               strncpy(p->id, str, sizeof(p->id) - 1);
+               strlcpy(p->id, str, sizeof(p->id));
                p->parse_peopt = pedit_parse_nopopt;
                goto reg;
        }
@@ -672,7 +672,6 @@ int parse_pedit(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
 
        parse_action_control_dflt(&argc, &argv, &sel.sel.action, false, TC_ACT_OK);
 
-       NEXT_ARG_FWD();
        if (argc) {
                if (matches(*argv, "index") == 0) {
                        NEXT_ARG();
@@ -686,8 +685,7 @@ int parse_pedit(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
                }
        }
 
-       tail = NLMSG_TAIL(n);
-       addattr_l(n, MAX_MSG, tca_id, NULL, 0);
+       tail = addattr_nest(n, MAX_MSG, tca_id);
        if (!sel.extended) {
                addattr_l(n, MAX_MSG, TCA_PEDIT_PARMS, &sel,
                          sizeof(sel.sel) +
@@ -700,7 +698,7 @@ int parse_pedit(struct action_util *a, int *argc_p, char ***argv_p, int tca_id,
                pedit_keys_ex_addattr(&sel, n);
        }
 
-       tail->rta_len = (void *)NLMSG_TAIL(n) - (void *)tail;
+       addattr_nest_end(n, tail);
 
        *argc_p = argc;
        *argv_p = argv;