Commit 5115fe7 for zlib
commit 5115fe785da449ddfe71b4fae8d6d4d8b20647b0
Author: Mark Adler <git@madler.net>
Date: Tue Nov 3 14:29:31 2026 -0800
Avoid use of caddr_t type in minigzip.c.
Thanks to kberry for the report.
diff --git a/test/minigzip.c b/test/minigzip.c
index 40da873..968220b 100644
--- a/test/minigzip.c
+++ b/test/minigzip.c
@@ -37,6 +37,9 @@
#ifdef USE_MMAP
# include <sys/types.h>
# include <sys/mman.h>
+# ifndef MAP_FAILED
+# define MAP_FAILED ((void *)-1)
+# endif
# include <sys/stat.h>
#endif
@@ -337,7 +340,7 @@ static int gz_compress_mmap(FILE *in, gzFile out) {
int len;
int err;
int ifd = fileno(in);
- caddr_t buf; /* mmap'ed buffer for the entire input file */
+ void *buf; /* mmap'ed buffer for the entire input file */
off_t buf_len; /* length of the input file */
struct stat sb;
@@ -347,8 +350,8 @@ static int gz_compress_mmap(FILE *in, gzFile out) {
if (buf_len <= 0) return Z_ERRNO;
/* Now do the actual mmap: */
- buf = mmap((caddr_t) 0, buf_len, PROT_READ, MAP_SHARED, ifd, (off_t)0);
- if (buf == (caddr_t)(-1)) return Z_ERRNO;
+ buf = mmap(NULL, buf_len, PROT_READ, MAP_SHARED, ifd, (off_t)0);
+ if (buf == MAP_FAILED) return Z_ERRNO;
/* Compress the whole file at once: */
len = gzwrite(out, (char *)buf, (unsigned)buf_len);