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 50EE143EBE for ; Wed, 17 Aug 2022 04:13:23 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 3D56468AE45; Wed, 17 Aug 2022 07:13:21 +0300 (EEST) Received: from mout-p-201.mailbox.org (mout-p-201.mailbox.org [80.241.56.171]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id D48DB68AE45 for ; Wed, 17 Aug 2022 07:13:13 +0300 (EEST) Received: from smtp202.mailbox.org (smtp202.mailbox.org [10.196.197.202]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mout-p-201.mailbox.org (Postfix) with ESMTPS id 4M6vkv1ZV0z9sGX for ; Wed, 17 Aug 2022 06:13:11 +0200 (CEST) Message-ID: Date: Wed, 17 Aug 2022 09:42:58 +0530 MIME-Version: 1.0 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <20220815183410.6741-1-ffmpeg@gyani.pro> <20220816230658.GA3168@mariano> From: Gyan Doshi In-Reply-To: <20220816230658.GA3168@mariano> Subject: Re: [FFmpeg-devel] [PATCH] ffprobe: restore reporting error code for failed inputs 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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 2022-08-17 04:36 am, Stefano Sabatini wrote: > On date Tuesday 2022-08-16 00:04:10 +0530, Gyan Doshi wrote: >> c11fb46731 led to a regression whereby the return code for missing >> input or input probe is overridden by writer close return code and >> hence not conveyed in the exit code. >> --- >> fftools/ffprobe.c | 6 +++++- >> 1 file changed, 5 insertions(+), 1 deletion(-) >> >> Affects 5.1 so will need to be backported there. >> >> diff --git a/fftools/ffprobe.c b/fftools/ffprobe.c >> index ad633ccc44..8983dc28cc 100644 >> --- a/fftools/ffprobe.c >> +++ b/fftools/ffprobe.c >> @@ -4032,7 +4032,7 @@ int main(int argc, char **argv) >> WriterContext *wctx; >> char *buf; >> char *w_name = NULL, *w_args = NULL; >> - int ret, i; >> + int ret, input_ret, i; >> >> init_dynload(); >> >> @@ -4156,10 +4156,14 @@ int main(int argc, char **argv) >> show_error(wctx, ret); >> } >> >> + input_ret = ret; >> + >> writer_print_section_footer(wctx); >> ret = writer_close(&wctx); >> if (ret < 0) >> av_log(NULL, AV_LOG_ERROR, "Writing output failed: %s\n", av_err2str(ret)); >> + >> + ret = FFMIN(ret, input_ret); > maybe we should give priority to input_ret in case they are both > negative? > > return input_ret < 0 ? input_ret : ret; Scripts usually depend on exit code being 0 or something else. Also, error is logged for both input failure and writer_close failure, so it doesn't matter. Finally, input_ret is not initialized if writer_open fails, so we shouldn't be referencing it outside. Regards, Gyan _______________________________________________ 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".