From c569eb998b369eb62cdf46006ed3ff4dcc23b32b Mon Sep 17 00:00:00 2001 From: ru Date: Sat, 20 Aug 2005 08:34:21 +0000 Subject: Bail if interface is misspelled instead of falling out into the "all interfaces" mode. (Only works with -w, but still better than nothing.) --- usr.bin/netstat/if.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/usr.bin/netstat/if.c b/usr.bin/netstat/if.c index b8b5a81..4bab18e 100644 --- a/usr.bin/netstat/if.c +++ b/usr.bin/netstat/if.c @@ -608,6 +608,8 @@ sidewaysintpr(unsigned interval1, u_long off) ip = ipn; off = (u_long)TAILQ_NEXT(&ifnet, if_link); } + if (interface && interesting == NULL) + errx(1, "%s: unknown interface", interface); if ((total = malloc(sizeof(struct iftot))) == NULL) { printf("malloc failed\n"); exit(1); -- cgit v1.1