From ec5b87f3610b3b0e52ce6109600930deb5996cca Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Wed, 15 Jan 2020 15:42:31 -0500 Subject: [PATCH] Fix: include stdlib.h in compat/string.h MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fixes: CC uuid.lo In file included from /home/smarchi/src/lttng-tools/src/common/uuid.c:19:0: /home/smarchi/src/lttng-tools/src/common/compat/string.h: In function ‘lttng_strndup’: /home/smarchi/src/lttng-tools/src/common/compat/string.h:78:8: error: implicit declaration of function ‘malloc’ [-Werror=implicit-function-declaration] ret = malloc(navail); ^~~~~~ /home/smarchi/src/lttng-tools/src/common/compat/string.h:78:8: error: incompatible implicit declaration of built-in function ‘malloc’ [-Werror] /home/smarchi/src/lttng-tools/src/common/compat/string.h:78:8: note: include ‘’ or provide a declaration of ‘malloc’ Note that this is in fallback code when the system doesn't provide strndup (or, in my case, the system provides it but configure failed to find it). Change-Id: I5817b0b2436573b7d8fecb2956577a7b183d6296 Signed-off-by: Jérémie Galarneau --- src/common/compat/string.h | 1 + 1 file changed, 1 insertion(+) diff --git a/src/common/compat/string.h b/src/common/compat/string.h index adb32530b..a18d9e7ca 100644 --- a/src/common/compat/string.h +++ b/src/common/compat/string.h @@ -10,6 +10,7 @@ #define _COMPAT_STRING_H #include +#include #ifdef HAVE_STRNLEN static inline -- 2.34.1