diff mbox series

[iproute2-next,v1,4/6] iplink_can: use invarg() instead of fprintf()

Message ID 20241112172812.590665-12-mailhol.vincent@wanadoo.fr (mailing list archive)
State Accepted
Commit 68aaea862838bdaae5dcf3905188b97fcee32cbd
Delegated to: David Ahern
Headers show
Series iplink_can: preparation before introduction of CAN XL | expand

Checks

Context Check Description
netdev/tree_selection success Not a local patch

Commit Message

Vincent Mailhol Nov. 12, 2024, 5:27 p.m. UTC
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>
---
 ip/iplink_can.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
diff mbox series

Patch

diff --git a/ip/iplink_can.c b/ip/iplink_can.c
index 6c6fcf61..928d5d79 100644
--- a/ip/iplink_can.c
+++ b/ip/iplink_can.c
@@ -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;