From b28c6d0ba5693949a6b64cad446276e8886e3f3b Mon Sep 17 00:00:00 2001 From: wm4 Date: Sun, 2 Sep 2012 20:30:16 +0200 Subject: options: fix "--" Handling this was accidentally forgotten when command line parsing was refactored. The added recursive call should be a tail recursion with all reasonable compilers, and it shouldn't be possible to provoke a stack overflow. --- parser-mpcmd.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/parser-mpcmd.c b/parser-mpcmd.c index 41cad67467..d87e820e0f 100644 --- a/parser-mpcmd.c +++ b/parser-mpcmd.c @@ -70,6 +70,11 @@ static int split_opt_silent(struct parse_state *p) if (p->no_more_opts || !bstr_startswith0(p->arg, "-") || p->arg.len == 1) return 0; + if (bstrcmp0(p->arg, "--") == 0) { + p->no_more_opts = true; + return split_opt_silent(p); + } + bool old_syntax = !bstr_startswith0(p->arg, "--"); if (old_syntax) { p->arg = bstr_cut(p->arg, 1); -- cgit v1.2.3