> On Mar 26, 2025, at 18:38, Jun Zhao <myp...@gmail.com> wrote: > > From: Jun Zhao <mypopy...@gmail.com> > > When running 'ffmpeg -init_hw_device list' to display available hardware > devices, it incorrectly shows an error message: > "Failed to set value 'list' for option 'init_hw_device': Immediate exit > requested" > > This is a regression introduced by commit a50f90f1c23. The command is > actually working as intended - it should exit after listing devices, but > shouldn't display an error message. > > Signed-off-by: Jun Zhao <barryjz...@tencent.com> > --- > fftools/cmdutils.c | 8 +++++--- > 1 file changed, 5 insertions(+), 3 deletions(-) > > diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c > index 8ac20bf049..aa782c7754 100644 > --- a/fftools/cmdutils.c > +++ b/fftools/cmdutils.c > @@ -352,9 +352,11 @@ static int write_option(void *optctx, const OptionDef > *po, const char *opt, > > ret = po->u.func_arg(optctx, opt, arg); > if (ret < 0) { > - av_log(NULL, AV_LOG_ERROR, > - "Failed to set value '%s' for option '%s': %s\n", > - arg, opt, av_err2str(ret)); > + if (strcmp(opt, "init_hw_device") || strcmp(arg, "list")) { > + av_log(NULL, AV_LOG_ERROR, > + "Failed to set value '%s' for option '%s': %s\n", > + arg, opt, av_err2str(ret)); > + }
Clang-tidy shows "Function 'strcmp' is called without explicitly comparing result”. Missing `!` is a common mistake when use strcmp. The static analysis tool doesn't know whether it’s a typo or on purpose in `if (strcmp())`, so it requires explicitly comparing result `if (strcmp() != 0)`. > goto finish; > } > } > -- > 2.25.1 > > _______________________________________________ > ffmpeg-devel mailing list > ffmpeg-devel@ffmpeg.org > https://ffmpeg.org/mailman/listinfo/ffmpeg-devel > > To unsubscribe, visit link above, or email > ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe". _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".