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
This commit is contained in:
parent
d630df9bba
commit
868ea02b2f
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user