From 92b7148242bcb27e6e413b3a4961d12da67a86f6 Mon Sep 17 00:00:00 2001 From: "Kelvin M. Klann" Date: Tue, 26 Apr 2022 17:14:20 -0300 Subject: hostnames.c: fix mismatched dealloc (fclose -> pclose) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Partial error log when building firejail-git (afee8603f) with --enable-fatal-warnings: hostnames.c: In function ‘retrieve_hostname’: hostnames.c:53:17: error: ‘fclose’ called on pointer returned from a mismatched allocation function [-Werror=mismatched-dealloc] 53 | fclose(fp); | ^~~~~~~~~~ hostnames.c:38:20: note: returned from ‘popen’ 38 | FILE *fp = popen(cmd, "r"); | ^~~~~~~~~~~~~~~ cc1: all warnings being treated as errors make[1]: *** [Makefile:7: hostnames.o] Error 1 Environment: gcc 11.2.0-4 on Artix Linux. Added on commit 500a56efd ("more on nettrace", 2022-01-07). --- src/fnettrace/hostnames.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/fnettrace/hostnames.c b/src/fnettrace/hostnames.c index dd92070bf..71ce672b5 100644 --- a/src/fnettrace/hostnames.c +++ b/src/fnettrace/hostnames.c @@ -50,7 +50,7 @@ char *retrieve_hostname(uint32_t ip) { } } } - fclose(fp); + pclose(fp); return rv; } else -- cgit v1.2.3-54-g00ecf