diff --git a/source3/utils/split_tokens.c b/source3/utils/split_tokens.c index 6693f010edf..ab48dc5c9c1 100644 --- a/source3/utils/split_tokens.c +++ b/source3/utils/split_tokens.c @@ -32,6 +32,7 @@ int main(int argc, const char *argv[]) poptContext pc; char *buff; TALLOC_CTX *ctx = talloc_stackframe(); + int opt; bool ok; struct poptOption long_options[] = { @@ -64,7 +65,15 @@ int main(int argc, const char *argv[]) poptSetOtherOptionHelp(pc, "[OPTION...] "); - while(poptGetNextOpt(pc) != -1); + while((opt = poptGetNextOpt(pc)) != -1) { + switch (opt) { + case POPT_ERROR_BADOPT: + fprintf(stderr, "\nInvalid option %s: %s\n\n", + poptBadOption(pc, 0), poptStrerror(opt)); + poptPrintUsage(pc, stderr, 0); + exit(1); + } + } sequence = poptGetArg(pc);