aboutsummaryrefslogtreecommitdiffstats
path: root/erts/emulator/drivers/common/zlib_drv.c
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2014-03-20 16:50:53 +0100
committerBjörn Gustavsson <[email protected]>2014-03-21 14:34:41 +0100
commit6e318949a19c7603d23da64f312b96ecf950ee30 (patch)
treee26371e07d1be2607e1406751c2a6b96714481a1 /erts/emulator/drivers/common/zlib_drv.c
parent4e982a63474d1ab92544662d34a75a8303733fbe (diff)
downloadotp-6e318949a19c7603d23da64f312b96ecf950ee30.tar.gz
otp-6e318949a19c7603d23da64f312b96ecf950ee30.tar.bz2
otp-6e318949a19c7603d23da64f312b96ecf950ee30.zip
zlib: Fix adler32_combine/4 and crc32_combine/4
Since our config.h is included in each source file in the zlib directory, we must make sure that config.h is also included every time zlib functions are called to ensure that definitions of types are consistent. zlib_drv.c did not include config.h, which caused problems on a MacOS X Leopard system. What happened was that HAVE_UNISTD_H was not defined when zlib.h was included. When unistd.h is not known to exist, the type z_off_t will be set to a long (32 bits on this platform). But when the zlib source files were compiled, HAVE_UNISTD_H was defined, unistd.h would be included, and z_off_t would be set to off_t (64 bits; defined in unistd.h). As a result of the mismatch, calls to the adler32_combine() and crc32_combine() would pass only 32 bits in the len2 argument when 64 bits were expected.
Diffstat (limited to 'erts/emulator/drivers/common/zlib_drv.c')
-rw-r--r--erts/emulator/drivers/common/zlib_drv.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/erts/emulator/drivers/common/zlib_drv.c b/erts/emulator/drivers/common/zlib_drv.c
index 3fe5d282dc..3143e4511d 100644
--- a/erts/emulator/drivers/common/zlib_drv.c
+++ b/erts/emulator/drivers/common/zlib_drv.c
@@ -21,6 +21,9 @@
* ZLib interface for erlang
*
*/
+#ifdef HAVE_CONFIG_H
+# include "config.h"
+#endif
#include <stdio.h>
#include <zlib.h>
#include <errno.h>