BUILD: ebtree: fix build on libmusl after recent introduction of eb_memcmp()
authorWilly Tarreau <w@1wt.eu>
Mon, 20 Jul 2020 19:40:14 +0000 (21:40 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 20 Jul 2020 19:40:14 +0000 (21:40 +0200)
In order to address a corner case with memory compares, commit 853926a
("BUG/MEDIUM: ebtree: use a byte-per-byte memcmp() to compare memory
blocks") introduced a new eb_memcmp() function, which uses ssize_t for
an offset. However this one is not known by default in ebtree for versions
prior to 2.2, and it depends on the libs. Musl requires unistd to be included
to have it.

This patch just adds this harmless include, which was verified to address
issue #760. There is no mainline commit ID as 2.2 and above already include
unistd.h as part of haproxy/api.h. It must be backported to older versions
(2.0 already has the commit above).

ebtree/ebtree.c

index e82ed59..10cc2ff 100644 (file)
@@ -18,6 +18,7 @@
  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
  */
 
+#include <unistd.h>
 #include "ebtree.h"
 
 void eb_delete(struct eb_node *node)