Skip to content

Commit b951821

Browse files
InterLinked1Friendly Automation
authored and
Friendly Automation
committed
app.c: Throw warnings for nonexistent options
Currently, Asterisk doesn't throw warnings if options are passed into applications that don't accept them. This can confuse users if they're unaware that they are doing something wrong. This adds an additional check to parse_options so that a warning is thrown anytime an option is parsed that doesn't exist in the parsing application, so that users are notified of the invalid usage. ASTERISK-29801 #close Change-Id: Id029274a57135caca193c913307a63fd75e24679
1 parent 4f06de7 commit b951821

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

main/app.c

+3
Original file line numberDiff line numberDiff line change
@@ -2937,6 +2937,9 @@ static int parse_options(const struct ast_app_option *options, void *_flags, cha
29372937
} else if (argloc) {
29382938
args[argloc - 1] = "";
29392939
}
2940+
if (!options[curarg].flag) {
2941+
ast_log(LOG_WARNING, "Unrecognized option: '%c'\n", curarg);
2942+
}
29402943
if (flaglen == 32) {
29412944
ast_set_flag(flags, options[curarg].flag);
29422945
} else {

0 commit comments

Comments
 (0)