summaryrefslogtreecommitdiff
path: root/fftools/ffprobe.c
diff options
context:
space:
mode:
authorAnton Khirnov <anton@khirnov.net>2023-07-14 16:43:51 +0200
committerAnton Khirnov <anton@khirnov.net>2023-07-20 20:47:46 +0200
commit39d5104332b1e78cb8e2d34dde072d3732d2eca1 (patch)
treea3a67e567b68af87f08fe7c8cfa4c0a28a802659 /fftools/ffprobe.c
parent49ac7fc48566a5cc33c0cd1a2806251fddb52a03 (diff)
fftools: handle errors in parse_options()
Diffstat (limited to 'fftools/ffprobe.c')
-rw-r--r--fftools/ffprobe.c10
1 files changed, 7 insertions, 3 deletions
diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c
index e6fd33492d..ba55437760 100644
--- a/fftools/ffprobe.c
+++ b/fftools/ffprobe.c
@@ -3770,17 +3770,19 @@ static int opt_show_entries(void *optctx, const char *opt, const char *arg)
return ret;
}
-static void opt_input_file(void *optctx, const char *arg)
+static int opt_input_file(void *optctx, const char *arg)
{
if (input_filename) {
av_log(NULL, AV_LOG_ERROR,
"Argument '%s' provided as input filename, but '%s' was already specified.\n",
arg, input_filename);
- exit_program(1);
+ return AVERROR(EINVAL);
}
if (!strcmp(arg, "-"))
arg = "fd:";
input_filename = arg;
+
+ return 0;
}
static int opt_input_file_i(void *optctx, const char *opt, const char *arg)
@@ -4121,7 +4123,9 @@ int main(int argc, char **argv)
#endif
show_banner(argc, argv, options);
- parse_options(NULL, argc, argv, options, opt_input_file);
+ ret = parse_options(NULL, argc, argv, options, opt_input_file);
+ if (ret < 0)
+ exit_program(1);
if (do_show_log)
av_log_set_callback(log_callback);