Compiling 5.1.23 under NetBSD/amd64, I got a printf format error because %d was used to print key_t, which was of type long. POSIX requires only that it be an arithmetic type, and long certainly is within reason. I think it's reasonable to assume it is an integral type. One option is to cast to long and use %ld, but I (in adding a patch to pkgsrc) chose to cast to intmax_t.
--- apc_shm.c.orig 2023-12-04 01:27:07.199895899 +0000
+++ apc_shm.c
@@ -53,7 +53,7 @@ int apc_shm_create(int proj, size_t size
oflag = IPC_CREAT | SHM_R | SHM_A;
if ((shmid = shmget(key, size, oflag)) < 0) {
- zend_error_noreturn(E_CORE_ERROR, "apc_shm_create: shmget(%d, %zd, %d) failed: %s. It is possible that the chosen SHM segment size is higher than the operation system allows. Linux has usually a default limit of 32MB per segment.", key, size, oflag, strerror(errno));
+ zend_error_noreturn(E_CORE_ERROR, "apc_shm_create: shmget(%jd, %zd, %d) failed: %s. It is possible that the chosen SHM segment size is higher than the operation system allows. Linux has usually a default limit of
32MB per segment.", (intmax_t) key, size, oflag, strerror(errno));
}
return shmid;
Compiling 5.1.23 under NetBSD/amd64, I got a printf format error because
%d
was used to printkey_t
, which was of typelong
. POSIX requires only that it be an arithmetic type, and long certainly is within reason. I think it's reasonable to assume it is an integral type. One option is to cast to long and use%ld
, but I (in adding a patch to pkgsrc) chose to cast tointmax_t
.