[PATCH] erofs-utils: lib: guard gzran zlib.h inclusion

Matthew Lear matthew.lear at raspberrypi.com
Tue Mar 17 23:24:48 AEDT 2026


gzran.c unconditionally includes zlib.h which doesn't compile on
systems without zlib.

Signed-off-by: Matthew Lear <matthew.lear at raspberrypi.com>
---
 lib/gzran.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/lib/gzran.c b/lib/gzran.c
index dffb20a..bf99796 100644
--- a/lib/gzran.c
+++ b/lib/gzran.c
@@ -6,9 +6,9 @@
 #include "erofs/err.h"
 #include "liberofs_gzran.h"
 #include <stdlib.h>
-#include <zlib.h>

 #ifdef HAVE_ZLIB
+#include <zlib.h>
 struct erofs_gzran_cutpoint {
 	u8	window[EROFS_GZRAN_WINSIZE];	/* preceding 32K of uncompressed data */
 	u64	outpos;			/* corresponding offset in uncompressed data */
-- 
2.43.0


More information about the Linux-erofs mailing list