dht-bootstrap.c | 18 +++++++++--------- diff --git a/dht-bootstrap.c b/dht-bootstrap.c index d96b0f7a763623dd93c53684ac3ca140d8248798..a282b782abdcbd63e691e7bfe16f237d83959d11 100644 --- a/dht-bootstrap.c +++ b/dht-bootstrap.c @@ -406,6 +406,15 @@ goto usage; } } + i = optind; + + if(argc < i + 1) + goto usage; + + port = atoi(argv[i++]); + if(port <= 0 || port >= 0x10000) + goto usage; + if(ipv4) { dht_socket = socket(PF_INET, SOCK_DGRAM, 0); if(dht_socket < 0) @@ -514,15 +523,6 @@ if(!quiet) dht_debug = stdout; - i = optind; - - if(argc < i + 1) - goto usage; - - port = atoi(argv[i++]); - if(port <= 0 || port >= 0x10000) - goto usage; - while(i < argc) { struct addrinfo hints, *info, *infop; memset(&hints, 0, sizeof(hints));