summaryrefslogtreecommitdiffstats
path: root/usr.sbin/wicontrol
diff options
context:
space:
mode:
authorjoe <joe@FreeBSD.org>2000-10-28 16:25:25 +0000
committerjoe <joe@FreeBSD.org>2000-10-28 16:25:25 +0000
commitcc8a57c9b998de1a547c609f571a31b1aa238795 (patch)
treeb86167023def68017414ffb8255bc227b765ba04 /usr.sbin/wicontrol
parentaf22c2e96e5e8afab635cc207929e943785c6746 (diff)
downloadFreeBSD-src-cc8a57c9b998de1a547c609f571a31b1aa238795.zip
FreeBSD-src-cc8a57c9b998de1a547c609f571a31b1aa238795.tar.gz
When an interface isn't specified use wi0 as the default.
This gets around a segmentation fault that occurs when the interface isn't specified first before any of the options. Inspired by PR: bin/22241
Diffstat (limited to 'usr.sbin/wicontrol')
-rw-r--r--usr.sbin/wicontrol/wicontrol.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/usr.sbin/wicontrol/wicontrol.c b/usr.sbin/wicontrol/wicontrol.c
index fbd81a3..ecbc2ea 100644
--- a/usr.sbin/wicontrol/wicontrol.c
+++ b/usr.sbin/wicontrol/wicontrol.c
@@ -697,6 +697,18 @@ int main(argc, argv)
char *key = NULL;
int modifier = 0;
+ /* Get the interface name */
+ opterr = 0;
+ ch = getopt(argc, argv, "i:");
+ if (ch == 'i') {
+ iface = optarg;
+ } else {
+ iface = "wi0";
+ optreset = 1;
+ optind = 1;
+ }
+ opterr = 1;
+
while((ch = getopt(argc, argv,
"hoc:d:e:f:i:k:p:r:q:t:n:s:m:v:P:S:T:ZC")) != -1) {
switch(ch) {
@@ -720,9 +732,6 @@ int main(argc, argv)
wi_dumpstats(iface);
exit(0);
break;
- case 'i':
- iface = optarg;
- break;
case 'c':
wi_setword(iface, WI_RID_CREATE_IBSS, atoi(optarg));
exit(0);
OpenPOWER on IntegriCloud