From b377975a139a43907e1cee045a4ef3d589235dbd Mon Sep 17 00:00:00 2001 From: tiptorrent development team Date: Thu, 10 Feb 2022 15:29:02 +0100 Subject: fix -r/--redirect optional argument --- src/main.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/main.c b/src/main.c index 84fd846..2765467 100644 --- a/src/main.c +++ b/src/main.c @@ -67,8 +67,9 @@ int main(int argc, char *argv[]) } break; case 'r': - if (optarg) { - max_redirect = atoi(optarg); + if (optind < argc && + argv[optind][0] != '-') { + max_redirect = atoi(argv[optind++]); if (max_redirect <= 0) { syslog(LOG_ERR, "Invalid number for redirections"); return EXIT_FAILURE; -- cgit v1.2.3-18-g5258