diff mbox series

[FFmpeg-devel,2/5] fftools/cmdutils: do not treat single '-' as an option in locate_option()

Message ID 20241007105016.1597-2-anton@khirnov.net
State New
Headers show
Series [FFmpeg-devel,1/5] fftools/cmdutils: group related calls together | expand

Checks

Context Check Description
yinshiyou/make_loongarch64 success Make finished
yinshiyou/make_fate_loongarch64 success Make fate finished

Commit Message

Anton Khirnov Oct. 7, 2024, 10:50 a.m. UTC
Fixes early parsing of trailing -v/-loglevel while using '-' to output
to stdout.
---
 fftools/cmdutils.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c
index 9eb49dbf20..8ac20bf049 100644
--- a/fftools/cmdutils.c
+++ b/fftools/cmdutils.c
@@ -492,8 +492,9 @@  int locate_option(int argc, char **argv, const OptionDef *options,
     for (i = 1; i < argc; i++) {
         const char *cur_opt = argv[i];
 
-        if (*cur_opt++ != '-')
+        if (!(cur_opt[0] == '-' && cur_opt[1]))
             continue;
+        cur_opt++;
 
         po = find_option(options, cur_opt);
         if (!po->name && cur_opt[0] == 'n' && cur_opt[1] == 'o')