summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorru <ru@FreeBSD.org>2005-08-20 08:34:21 +0000
committerru <ru@FreeBSD.org>2005-08-20 08:34:21 +0000
commitc569eb998b369eb62cdf46006ed3ff4dcc23b32b (patch)
tree5e94901348fd8c51d75988a38856b3e39b12217c
parentbca82361aaefb3fe4b561e305d15cd9cfc5c59ec (diff)
downloadFreeBSD-src-c569eb998b369eb62cdf46006ed3ff4dcc23b32b.zip
FreeBSD-src-c569eb998b369eb62cdf46006ed3ff4dcc23b32b.tar.gz
Bail if interface is misspelled instead of falling out into the
"all interfaces" mode. (Only works with -w, but still better than nothing.)
-rw-r--r--usr.bin/netstat/if.c2
1 files changed, 2 insertions, 0 deletions
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);
OpenPOWER on IntegriCloud