From 5d93e9a9578f33fb51b5115b2d116856c35a0ca0 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Tue, 2 Nov 2021 17:10:02 -0400 Subject: [PATCH] av_write_trailer can return a positive value which is not an error --- src/zm_videostore.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/zm_videostore.cpp b/src/zm_videostore.cpp index 72a1fb541..bb8cac343 100644 --- a/src/zm_videostore.cpp +++ b/src/zm_videostore.cpp @@ -638,7 +638,8 @@ VideoStore::~VideoStore() { Debug(1, "Writing trailer"); /* Write the trailer before close */ - if ( int rc = av_write_trailer(oc) ) { + int rc; + if ((rc = av_write_trailer(oc)) < 0) { Error("Error writing trailer %s", av_err2str(rc)); } else { Debug(3, "Success Writing trailer"); @@ -648,7 +649,7 @@ VideoStore::~VideoStore() { if (!(out_format->flags & AVFMT_NOFILE)) { /* Close the out file. */ Debug(4, "Closing"); - if (int rc = avio_close(oc->pb)) { + if ((rc = avio_close(oc->pb)) < 0) { Error("Error closing avio %s", av_err2str(rc)); } } else {