summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2012-09-02 20:30:16 +0200
committerwm4 <wm4@nowhere>2012-09-18 21:07:29 +0200
commitb28c6d0ba5693949a6b64cad446276e8886e3f3b (patch)
tree2ec8c9a6d216712a2a3282ef53364040070c8182
parent1ba5a8f283e3894158f12f025035903e13d0f8ae (diff)
downloadmpv-b28c6d0ba5693949a6b64cad446276e8886e3f3b.tar.bz2
mpv-b28c6d0ba5693949a6b64cad446276e8886e3f3b.tar.xz
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.
-rw-r--r--parser-mpcmd.c5
1 files changed, 5 insertions, 0 deletions
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);