[FFmpeg-devel] [PATCH 1/7] checkasm: fix Linux perf cleanup

Rémi Denis-Courmont remi at remlab.net
Fri Jul 14 21:28:29 EEST 2023


0 is a valid file descriptor.
---
 tests/checkasm/checkasm.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tests/checkasm/checkasm.c b/tests/checkasm/checkasm.c
index 4311a8ffcb..1da0877be5 100644
--- a/tests/checkasm/checkasm.c
+++ b/tests/checkasm/checkasm.c
@@ -317,7 +317,9 @@ static struct {
     const char *cpu_flag_name;
     const char *test_name;
     int verbose;
-} state;
+} state = {
+    .sysfd = -1,
+};
 
 /* PRNG state */
 AVLFG checkasm_lfg;
@@ -710,7 +712,7 @@ static int bench_init(void)
 static void bench_uninit(void)
 {
 #if CONFIG_LINUX_PERF
-    if (state.sysfd > 0)
+    if (state.sysfd != -1)
         close(state.sysfd);
 #endif
 }
-- 
2.40.1



More information about the ffmpeg-devel mailing list