]> git.proxmox.com Git - mirror_iproute2.git/blobdiff - tc/tc_qdisc.c
lib: introduce print_nl
[mirror_iproute2.git] / tc / tc_qdisc.c
index 2fcf04c336dfe9da17362cc0f93768080b87b5e4..c1d2df0171a75077a9d7981ca4ecbea6e881e83a 100644 (file)
@@ -199,10 +199,8 @@ static int tc_qdisc_modify(int cmd, unsigned int flags, int argc, char **argv)
                ll_init_map(&rth);
 
                idx = ll_name_to_index(d);
-               if (idx == 0) {
-                       fprintf(stderr, "Cannot find device \"%s\"\n", d);
-                       return 1;
-               }
+               if (!idx)
+                       return -nodev(d);
                req.t.tcm_ifindex = idx;
        }
 
@@ -270,8 +268,7 @@ int print_qdisc(const struct sockaddr_nl *who,
        print_string(PRINT_FP, NULL, " ", NULL);
 
        if (filter_ifindex == 0)
-               print_string(PRINT_ANY, "dev", "dev %s ",
-                            ll_index_to_name(t->tcm_ifindex));
+               print_devname(PRINT_ANY, t->tcm_ifindex);
 
        if (t->tcm_parent == TC_H_ROOT)
                print_bool(PRINT_ANY, "root", "root ", true);
@@ -379,10 +376,8 @@ static int tc_qdisc_list(int argc, char **argv)
 
        if (d[0]) {
                t.tcm_ifindex = ll_name_to_index(d);
-               if (t.tcm_ifindex == 0) {
-                       fprintf(stderr, "Cannot find device \"%s\"\n", d);
-                       return 1;
-               }
+               if (!t.tcm_ifindex)
+                       return -nodev(d);
                filter_ifindex = t.tcm_ifindex;
        }