]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
iplink_can: use invarg() instead of fprintf()
authorVincent Mailhol <mailhol.vincent@wanadoo.fr>
Tue, 12 Nov 2024 17:27:54 +0000 (02:27 +0900)
committerDavid Ahern <dsahern@kernel.org>
Mon, 18 Nov 2024 16:50:31 +0000 (16:50 +0000)
invarg() is specifically designed to print error messages when an
invalid argument is provided. Replace the generic fprintf() by
invarg() in can_parse_opt().

Signed-off-by: Vincent Mailhol <mailhol.vincent@wanadoo.fr>
Signed-off-by: David Ahern <dsahern@kernel.org>
ip/iplink_can.c

index 6c6fcf61253fc551a9eaaabdd5c7fd063c601502..928d5d79f3c529abc4ccc341c6e945a7a83d0b37 100644 (file)
@@ -254,10 +254,8 @@ static int can_parse_opt(struct link_util *lu, int argc, char **argv,
                                cm.mask |= CAN_CTRLMODE_TDC_AUTO |
                                           CAN_CTRLMODE_TDC_MANUAL;
                        } else {
-                               fprintf(stderr,
-                                       "Error: argument of \"tdc-mode\" must be \"auto\", \"manual\" or \"off\", not \"%s\"\n",
+                               invarg("\"tdc-mode\" must be either of \"auto\", \"manual\" or \"off\"",
                                        *argv);
-                               exit (-1);
                        }
                } else if (matches(*argv, "restart") == 0) {
                        __u32 val = 1;