wrk: crash fix

Apply patch suggested in issue https://github.com/termux/termux-packages/issues/5291.
This commit is contained in:
Leonid Pliushch 2020-05-14 00:57:04 +03:00
parent e3e5906829
commit 2ed046ac92
2 changed files with 26 additions and 1 deletions

View File

@ -2,7 +2,7 @@ TERMUX_PKG_HOMEPAGE=https://github.com/wg/wrk
TERMUX_PKG_DESCRIPTION="Modern HTTP benchmarking tool" TERMUX_PKG_DESCRIPTION="Modern HTTP benchmarking tool"
TERMUX_PKG_LICENSE="Apache-2.0" TERMUX_PKG_LICENSE="Apache-2.0"
TERMUX_PKG_VERSION=4.1.0 TERMUX_PKG_VERSION=4.1.0
TERMUX_PKG_REVISION=1 TERMUX_PKG_REVISION=2
TERMUX_PKG_SRCURL=https://github.com/wg/wrk/archive/${TERMUX_PKG_VERSION}.tar.gz TERMUX_PKG_SRCURL=https://github.com/wg/wrk/archive/${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=6fa1020494de8c337913fd139d7aa1acb9a020de6f7eb9190753aa4b1e74271e TERMUX_PKG_SHA256=6fa1020494de8c337913fd139d7aa1acb9a020de6f7eb9190753aa4b1e74271e
TERMUX_PKG_DEPENDS="openssl, luajit" TERMUX_PKG_DEPENDS="openssl, luajit"

View File

@ -0,0 +1,25 @@
diff -ur wrk-4.1.0-orig/src/zmalloc.c wrk-4.1.0/src/zmalloc.c
--- wrk-4.1.0-orig/src/zmalloc.c 2020-05-07 01:47:50.562052028 +0000
+++ wrk-4.1.0/src/zmalloc.c 2020-05-07 01:48:12.281671231 +0000
@@ -45,13 +45,19 @@
#include "zmalloc.h"
#include "atomicvar.h"
+#ifdef _LP64
+#define ALIGMENT (16)
+#else
+#define ALIGMENT (8)
+#endif
+#define ROUND_UP(n,r) (((n + r - 1) / r ) * r)
#ifdef HAVE_MALLOC_SIZE
#define PREFIX_SIZE (0)
#else
#if defined(__sun) || defined(__sparc) || defined(__sparc__)
-#define PREFIX_SIZE (sizeof(long long))
+#define PREFIX_SIZE (ROUND_UP(sizeof(long long), ALIGMENT))
#else
-#define PREFIX_SIZE (sizeof(size_t))
+#define PREFIX_SIZE (ROUND_UP(sizeof(size_t), ALIGMENT))
#endif
#endif