diff options
| author | 2021-08-04 22:27:55 +0200 | |
|---|---|---|
| committer | 2021-08-10 11:38:49 +0100 | |
| commit | 3d6365989f57a96f12e02dc85b111beb7947ec73 (patch) | |
| tree | 7dff3ca22d7da31a1e9cbbcaf9fed24cc92f2968 /src/inspircd.cpp | |
| parent | Makes NAMES reply with RPL_ENDOFNAMES even for nonexisting channels (diff) | |
Fix argv index error in 'unknown option' message.
It looks like ya_getopt increments `optind` between reading the argument
and returning.
Before:
```
$ ./build/GCC-8.3/bin/inspircd --foo bar
Error: unknown option 'bar'.
$ ./build/GCC-8.3/bin/inspircd --help
Error: unknown option '%
```
After:
```
$ ./build/GCC-8.3/bin/inspircd --foo bar
Error: unknown option '--foo'.
Usage: ./build/GCC-8.3/bin/inspircd [--config <file>] [--debug] [--nofork] [--nolog]
[--nopid] [--runasroot] [--version]
$ ./build/GCC-8.3/bin/inspircd --help
Error: unknown option '--help'.
Usage: ./build/GCC-8.3/bin/inspircd [--config <file>] [--debug] [--nofork] [--nolog]
[--nopid] [--runasroot] [--version]
```
Diffstat (limited to 'src/inspircd.cpp')
| -rw-r--r-- | src/inspircd.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/inspircd.cpp b/src/inspircd.cpp index 56b8178d2..f7421dd7b 100644 --- a/src/inspircd.cpp +++ b/src/inspircd.cpp @@ -324,7 +324,7 @@ namespace default: // An unknown option was specified. - std::cout << con_red << "Error:" << con_reset << " unknown option '" << argv[optind] << "'." << std::endl + std::cout << con_red << "Error:" << con_reset << " unknown option '" << argv[optind-1] << "'." << std::endl << con_bright << "Usage: " << con_reset << argv[0] << " [--config <file>] [--debug] [--nofork] [--nolog]" << std::endl << std::string(strlen(argv[0]) + 8, ' ') << "[--nopid] [--runasroot] [--version]" << std::endl; ServerInstance->Exit(EXIT_STATUS_ARGV); |
