diff --git a/src/hci/commands/ifmgmt_cmd.c b/src/hci/commands/ifmgmt_cmd.c index 3f3f6b51..350f14d0 100644 --- a/src/hci/commands/ifmgmt_cmd.c +++ b/src/hci/commands/ifmgmt_cmd.c @@ -53,6 +53,7 @@ int ifcommon_exec ( int argc, char **argv, int stop_on_first_success ) { struct ifcommon_options opts; struct net_device *netdev; + int i; int rc; /* Parse options */ @@ -61,11 +62,9 @@ int ifcommon_exec ( int argc, char **argv, if ( optind != argc ) { /* Treat arguments as a list of interfaces to try */ - while ( optind != argc ) { - if ( ( rc = parse_netdev ( argv[optind++], - &netdev ) ) != 0 ) { + for ( i = optind ; i < argc ; i++ ) { + if ( ( rc = parse_netdev ( argv[i], &netdev ) ) != 0 ) continue; - } if ( ( ( rc = payload ( netdev ) ) == 0 ) && stop_on_first_success ) { return 0;