From 8819aa61378fee8c58d2b307f802d24cc7a8acc9 Mon Sep 17 00:00:00 2001 From: Jason Stephenson Date: Tue, 19 Mar 2013 08:38:31 -0400 Subject: [PATCH] Fix segmentation fault in mbsdiff and fix crc by linking with libbz2. Doh! I typed memcpy when I really wanted memset. This does not actually introduce any new dependencies. Evergreen updates/installation already requires bzip2. If bzip2 is present, then libbz2 is present. We don't need libbz2 headers, just the library itself for a single data structure used in crc32 calculation. Signed-off-by: Jason Stephenson Signed-off-by: Ben Shum --- Open-ILS/xul/staff_client/external/libmar/configure.ac | 1 + Open-ILS/xul/staff_client/external/libmar/tool/bsdiff.c | 2 +- Open-ILS/xul/staff_client/external/libmar/tool/crc32.c | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/Open-ILS/xul/staff_client/external/libmar/configure.ac b/Open-ILS/xul/staff_client/external/libmar/configure.ac index e7715cd49a..0cfba6eadc 100644 --- a/Open-ILS/xul/staff_client/external/libmar/configure.ac +++ b/Open-ILS/xul/staff_client/external/libmar/configure.ac @@ -27,6 +27,7 @@ AC_PROG_CC AC_PROG_RANLIB # Checks for libraries. +AC_CHECK_LIB([bz2],[BZ2_bzCompressInit],,AC_MSG_ERROR(*** OpenILS requires libbz2)) # Checks for header files. AC_CHECK_HEADERS([err.h fcntl.h netinet/in.h stdint.h stdio.h stdlib.h string.h sys/stat.h sys/types.h unistd.h]) diff --git a/Open-ILS/xul/staff_client/external/libmar/tool/bsdiff.c b/Open-ILS/xul/staff_client/external/libmar/tool/bsdiff.c index ea384bbdc1..9aacd8351f 100644 --- a/Open-ILS/xul/staff_client/external/libmar/tool/bsdiff.c +++ b/Open-ILS/xul/staff_client/external/libmar/tool/bsdiff.c @@ -267,7 +267,7 @@ int main(int argc,char *argv[]) memcpy(header + 12, &outVal, 4); outVal = htonl(newsize); memcpy(header + 16, &outVal, 4); - memcpy(header + 20, 0, 12); + memset(header + 20, 0, 12); if (fwrite(header, 32, 1, pf) != 1) err(1, "fwrite(%s)", argv[3]); diff --git a/Open-ILS/xul/staff_client/external/libmar/tool/crc32.c b/Open-ILS/xul/staff_client/external/libmar/tool/crc32.c index d249076ab8..3bba38f149 100644 --- a/Open-ILS/xul/staff_client/external/libmar/tool/crc32.c +++ b/Open-ILS/xul/staff_client/external/libmar/tool/crc32.c @@ -6,7 +6,7 @@ #include /* This guy lives in libbz2, and is the only reason we need libbz2. */ - extern uint32_t BZ2_crc32Table[256]; +extern uint32_t BZ2_crc32Table[256]; uint32_t crc32(const unsigned char *buf, uint32_t len) @@ -15,7 +15,7 @@ crc32(const unsigned char *buf, uint32_t len) const unsigned char *end = buf + len; for (; buf != end; ++buf) - crc = (crc << 8) ^ crc32Table[(crc >> 24) ^ *buf]; + crc = (crc << 8) ^ BZ2_crc32Table[(crc >> 24) ^ *buf]; crc = ~crc; return crc; -- 2.11.0