diff options
author | Anton Khirnov <anton@khirnov.net> | 2023-07-14 18:15:27 +0200 |
---|---|---|
committer | Anton Khirnov <anton@khirnov.net> | 2023-07-20 20:47:46 +0200 |
commit | eda1fac27afdaaf646d9c84e6f2cea407764fbf2 (patch) | |
tree | 34c4e6e2b1feb8371e69b6d2fb46b9b2a7e1dd1c | |
parent | 8173623e39cc72866eaaac13538e160f226b0a23 (diff) | |
download | ffmpeg-eda1fac27afdaaf646d9c84e6f2cea407764fbf2.tar.gz |
fftools/cmdutils: return AVERROR_EXIT for OPT_EXIT options instead of aborting()
-rw-r--r-- | fftools/cmdutils.c | 2 | ||||
-rw-r--r-- | fftools/ffmpeg.c | 3 | ||||
-rw-r--r-- | fftools/ffmpeg_opt.c | 2 | ||||
-rw-r--r-- | fftools/ffplay.c | 2 | ||||
-rw-r--r-- | fftools/ffprobe.c | 2 |
5 files changed, 7 insertions, 4 deletions
diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index c2a783a983..45e93ab196 100644 --- a/fftools/cmdutils.c +++ b/fftools/cmdutils.c @@ -320,7 +320,7 @@ static int write_option(void *optctx, const OptionDef *po, const char *opt, } } if (po->flags & OPT_EXIT) - exit_program(0); + return AVERROR_EXIT; return 0; } diff --git a/fftools/ffmpeg.c b/fftools/ffmpeg.c index 0c5e553c72..50d6658472 100644 --- a/fftools/ffmpeg.c +++ b/fftools/ffmpeg.c @@ -1371,6 +1371,9 @@ int main(int argc, char **argv) err_rate_exceeded ? 69 : ret; finish: + if (ret == AVERROR_EXIT) + ret = 0; + exit_program(ret); return ret; } diff --git a/fftools/ffmpeg_opt.c b/fftools/ffmpeg_opt.c index 14b292f202..700db706a1 100644 --- a/fftools/ffmpeg_opt.c +++ b/fftools/ffmpeg_opt.c @@ -1345,7 +1345,7 @@ int ffmpeg_parse_options(int argc, char **argv) fail: uninit_parse_context(&octx); - if (ret < 0) { + if (ret < 0 && ret != AVERROR_EXIT) { av_log(NULL, AV_LOG_FATAL, "Error %s: %s\n", errmsg ? errmsg : "", av_err2str(ret)); } diff --git a/fftools/ffplay.c b/fftools/ffplay.c index df20c6a29d..a491fdd9e3 100644 --- a/fftools/ffplay.c +++ b/fftools/ffplay.c @@ -3657,7 +3657,7 @@ int main(int argc, char **argv) ret = parse_options(NULL, argc, argv, options, opt_input_file); if (ret < 0) - exit(1); + exit(ret == AVERROR_EXIT ? 0 : 1); if (!input_filename) { show_usage(); diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c index da8fc89830..c83d20995e 100644 --- a/fftools/ffprobe.c +++ b/fftools/ffprobe.c @@ -4129,7 +4129,7 @@ int main(int argc, char **argv) show_banner(argc, argv, options); ret = parse_options(NULL, argc, argv, options, opt_input_file); if (ret < 0) - exit_program(1); + exit_program(ret == AVERROR_EXIT ? 0 : 1); if (do_show_log) av_log_set_callback(log_callback); |