From 5b122d4f8ce02dfea0848fe7e0fff43ccf0d69ff Mon Sep 17 00:00:00 2001 From: Max Lv Date: Mon, 27 Feb 2017 13:37:07 +0800 Subject: [PATCH] Fix #1306 --- configure.ac | 2 +- src/utils.c | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/configure.ac b/configure.ac index c6764db7..d4dfd434 100755 --- a/configure.ac +++ b/configure.ac @@ -217,7 +217,7 @@ AC_CHECK_FUNCS([memset select setresuid setreuid strerror get_current_dir_name g AC_CHECK_LIB(socket, connect) dnl Checks for library functions. -AC_CHECK_FUNCS([malloc memset socket]) +AC_CHECK_FUNCS([malloc memset posix_memalign socket]) dnl Add define for libudns to enable IPv6 support dnl This is an option defined in the origin configure script diff --git a/src/utils.c b/src/utils.c index ec2d506a..5ebd3672 100644 --- a/src/utils.c +++ b/src/utils.c @@ -234,7 +234,11 @@ ss_align(size_t size) { int err; void *tmp; +#ifdef HAVE_POSIX_MEMALIGN err = posix_memalign(&tmp, sizeof(void *), size); +#else + err = -1; +#endif if (err) { return ss_malloc(size); } else {