From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id 90D2446345 for ; Sat, 15 Jul 2023 10:50:41 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 9E0F568C75B; Sat, 15 Jul 2023 13:47:06 +0300 (EEST) Received: from mail0.khirnov.net (red.khirnov.net [176.97.15.12]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 1FE9B68C6A6 for ; Sat, 15 Jul 2023 13:46:44 +0300 (EEST) Received: from localhost (localhost [IPv6:::1]) by mail0.khirnov.net (Postfix) with ESMTP id C9DFD2404EE for ; Sat, 15 Jul 2023 12:46:43 +0200 (CEST) Received: from mail0.khirnov.net ([IPv6:::1]) by localhost (mail0.khirnov.net [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id och-RHO0V2ef for ; Sat, 15 Jul 2023 12:46:43 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:2a00:c500:561:201::7]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "libav.khirnov.net", Issuer "smtp.khirnov.net SMTP CA" (verified OK)) by mail0.khirnov.net (Postfix) with ESMTPS id 156D7240D28 for ; Sat, 15 Jul 2023 12:46:27 +0200 (CEST) Received: from libav.khirnov.net (libav.khirnov.net [IPv6:::1]) by libav.khirnov.net (Postfix) with ESMTP id C28A93A27F9 for ; Sat, 15 Jul 2023 12:46:21 +0200 (CEST) From: Anton Khirnov To: ffmpeg-devel@ffmpeg.org Date: Sat, 15 Jul 2023 12:46:03 +0200 Message-Id: <20230715104611.17902-39-anton@khirnov.net> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230715104611.17902-1-anton@khirnov.net> References: <20230715104611.17902-1-anton@khirnov.net> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 39/47] fftools/cmdutils: return AVERROR_EXIT for OPT_EXIT options instead of aborting() X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: --- fftools/cmdutils.c | 2 +- fftools/ffmpeg.c | 3 +++ fftools/ffmpeg_opt.c | 2 +- fftools/ffplay.c | 2 +- fftools/ffprobe.c | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/fftools/cmdutils.c b/fftools/cmdutils.c index 9d9d8d44a6..f37b7d44d6 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); -- 2.40.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-request@ffmpeg.org with subject "unsubscribe".