This is an automated email from the ASF dual-hosted git repository.

zwoop pushed a commit to branch 9.0.x
in repository https://gitbox.apache.org/repos/asf/trafficserver.git

commit 7e73a385d3f13ea31faf0c6b5da23e19993f1db5
Author: Fei Deng <[email protected]>
AuthorDate: Fri Nov 8 13:44:16 2019 -0600

    detect bogus jemalloc version
    
    (cherry picked from commit 02c0e5b4e2b14fc2fab567762e24a1aede3f7e29)
---
 build/jemalloc.m4            | 13 ++++++++++++-
 include/tscore/JeAllocator.h |  3 +++
 2 files changed, 15 insertions(+), 1 deletion(-)

diff --git a/build/jemalloc.m4 b/build/jemalloc.m4
index 48b2cdc..6b707cd 100644
--- a/build/jemalloc.m4
+++ b/build/jemalloc.m4
@@ -68,7 +68,18 @@ if test "$enable_jemalloc" != "no"; then
     AC_CHECK_HEADERS(jemalloc/jemalloc.h, [jemalloc_have_headers=1])
   fi
   if test "$jemalloc_have_headers" != "0"; then
-    jemalloch=1
+    AC_RUN_IFELSE([
+      AC_LANG_PROGRAM(
+        [#include <jemalloc/jemalloc.h>],
+        [
+          #if (JEMALLOC_VERSION_MAJOR == 0)
+          exit(1);
+          #endif
+        ]
+      )],
+      [jemalloch=1],
+      [AC_MSG_ERROR(jemalloc has bogus version)]
+    )
   else
     CPPFLAGS=$saved_cppflags
     LDFLAGS=$saved_ldflags
diff --git a/include/tscore/JeAllocator.h b/include/tscore/JeAllocator.h
index 7d1b678..24e94d9 100644
--- a/include/tscore/JeAllocator.h
+++ b/include/tscore/JeAllocator.h
@@ -26,6 +26,9 @@
 
 #if TS_HAS_JEMALLOC
 #include <jemalloc/jemalloc.h>
+#if (JEMALLOC_VERSION_MAJOR == 0)
+#error jemalloc has bogus version
+#endif
 #if (JEMALLOC_VERSION_MAJOR == 5) && defined(MADV_DONTDUMP)
 #define JEMALLOC_NODUMP_ALLOCATOR_SUPPORTED 1
 #endif /* MADV_DONTDUMP */

Reply via email to