fix -r/--redirect optional argument

master
tiptorrent development team 2022-02-10 15:29:02 +01:00
parent 64d45f4237
commit b377975a13
1 changed files with 3 additions and 2 deletions

View File

@ -67,8 +67,9 @@ int main(int argc, char *argv[])
} }
break; break;
case 'r': case 'r':
if (optarg) { if (optind < argc &&
max_redirect = atoi(optarg); argv[optind][0] != '-') {
max_redirect = atoi(argv[optind++]);
if (max_redirect <= 0) { if (max_redirect <= 0) {
syslog(LOG_ERR, "Invalid number for redirections"); syslog(LOG_ERR, "Invalid number for redirections");
return EXIT_FAILURE; return EXIT_FAILURE;