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 ESMTPS id D0AA44E6AA for ; Wed, 7 May 2025 12:55:48 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 198C168BE1D; Wed, 7 May 2025 15:55:46 +0300 (EEST) Received: from iq.passwd.hu (iq.passwd.hu [217.27.212.140]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id D26D368BDC8 for ; Wed, 7 May 2025 15:55:43 +0300 (EEST) Received: from localhost (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id C16F9EB8BE; Wed, 7 May 2025 14:53:06 +0200 (CEST) X-Virus-Scanned: amavisd-new at passwd.hu Received: from iq.passwd.hu ([127.0.0.1]) by localhost (iq.passwd.hu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id fVUCyo9z2DiQ; Wed, 7 May 2025 14:52:36 +0200 (CEST) Received: from bluegene.passwd.hu (localhost [127.0.0.1]) by iq.passwd.hu (Postfix) with ESMTP id 27BAFEB8CD; Wed, 7 May 2025 14:52:07 +0200 (CEST) From: Marton Balint To: ffmpeg-devel@ffmpeg.org Date: Wed, 7 May 2025 14:54:32 +0200 Message-ID: <20250507125435.25852-2-cus@passwd.hu> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250507125435.25852-1-cus@passwd.hu> References: <20250507125435.25852-1-cus@passwd.hu> MIME-Version: 1.0 Subject: [FFmpeg-devel] [PATCH 2/2] fftools/textformat: correctly propagate uninit error codes 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 Cc: Marton Balint 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: This allows catching IO errors occuring at file close. Signed-off-by: Marton Balint --- fftools/textformat/avtextformat.c | 4 ++-- fftools/textformat/avtextformat.h | 2 +- fftools/textformat/avtextwriters.h | 2 +- fftools/textformat/tw_avio.c | 6 ++++-- 4 files changed, 8 insertions(+), 6 deletions(-) diff --git a/fftools/textformat/avtextformat.c b/fftools/textformat/avtextformat.c index 5abf81194e..3c9193bb64 100644 --- a/fftools/textformat/avtextformat.c +++ b/fftools/textformat/avtextformat.c @@ -114,7 +114,7 @@ int avtext_context_close(AVTextFormatContext **ptctx) if (tctx->formatter) { if (tctx->formatter->uninit) - tctx->formatter->uninit(tctx); + ret = tctx->formatter->uninit(tctx); if (tctx->formatter->priv_class) av_opt_free(tctx->priv); } @@ -594,7 +594,7 @@ int avtextwriter_context_close(AVTextWriterContext **pwctx) if (wctx->writer) { if (wctx->writer->uninit) - wctx->writer->uninit(wctx); + ret = wctx->writer->uninit(wctx); if (wctx->writer->priv_class) av_opt_free(wctx->priv); } diff --git a/fftools/textformat/avtextformat.h b/fftools/textformat/avtextformat.h index 9fad3caae5..169305927b 100644 --- a/fftools/textformat/avtextformat.h +++ b/fftools/textformat/avtextformat.h @@ -72,7 +72,7 @@ typedef struct AVTextFormatter { const char *name; int (*init) (AVTextFormatContext *tctx); - void (*uninit)(AVTextFormatContext *tctx); + int (*uninit)(AVTextFormatContext *tctx); void (*print_section_header)(AVTextFormatContext *tctx, const void *data); void (*print_section_footer)(AVTextFormatContext *tctx); diff --git a/fftools/textformat/avtextwriters.h b/fftools/textformat/avtextwriters.h index 87b0024ba1..04e5edcb67 100644 --- a/fftools/textformat/avtextwriters.h +++ b/fftools/textformat/avtextwriters.h @@ -38,7 +38,7 @@ typedef struct AVTextWriter { const char *name; int (* init)(AVTextWriterContext *wctx); - void (* uninit)(AVTextWriterContext *wctx); + int (* uninit)(AVTextWriterContext *wctx); void (* writer_w8)(AVTextWriterContext *wctx, int b); void (* writer_put_str)(AVTextWriterContext *wctx, const char *str); void (* writer_printf)(AVTextWriterContext *wctx, const char *fmt, ...); diff --git a/fftools/textformat/tw_avio.c b/fftools/textformat/tw_avio.c index 6034f74ec9..35c595f457 100644 --- a/fftools/textformat/tw_avio.c +++ b/fftools/textformat/tw_avio.c @@ -36,12 +36,14 @@ typedef struct IOWriterContext { int close_on_uninit; } IOWriterContext; -static av_cold void iowriter_uninit(AVTextWriterContext *wctx) +static av_cold int iowriter_uninit(AVTextWriterContext *wctx) { IOWriterContext *ctx = wctx->priv; + int ret = 0; if (ctx->close_on_uninit) - avio_closep(&ctx->avio_context); + ret = avio_closep(&ctx->avio_context); + return ret; } static void io_w8(AVTextWriterContext *wctx, int b) -- 2.43.0 _______________________________________________ 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".