From: Michal Sojka Date: Wed, 5 Feb 2014 15:48:18 +0000 (+0100) Subject: cangw: Print error message on misspelled interface X-Git-Url: https://rtime.felk.cvut.cz/gitweb/can-utils.git/commitdiff_plain/cb1091fa1039d7e5f366b16532af3c3932666db1 cangw: Print error message on misspelled interface If can interface is misspelled or the kernel is configured without netlink cangw displayed only generic usage instruction. Now, an appropriate error message is displayed. Signed-off-by: Michal Sojka --- diff --git a/cangw.c b/cangw.c index ff76fd7..f408993 100644 --- a/cangw.c +++ b/cangw.c @@ -602,10 +602,18 @@ int main(int argc, char **argv) case 's': src_ifindex = if_nametoindex(optarg); + if (src_ifindex == 0) { + perror(optarg); + return 1; + } break; case 'd': dst_ifindex = if_nametoindex(optarg); + if (dst_ifindex == 0) { + perror(optarg); + return 1; + } break; case 't':