From: Simon Marchi Date: Sun, 23 Jan 2022 01:37:19 +0000 (-0500) Subject: compat: fix compilation with !BABELTRACE_HAVE_OPEN_MEMSTREAM X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=516bf0a77e025cfccce2fa400b757e94dc0bf1d8 compat: fix compilation with !BABELTRACE_HAVE_OPEN_MEMSTREAM When commenting out BABELTRACE_HAVE_OPEN_MEMSTREAM in config.h, to test the alternative implementation of bt_open_memstream, I get: CC decoder.lo In file included from /home/simark/src/babeltrace/src/plugins/ctf/common/metadata/decoder.c:20: /home/simark/src/babeltrace/src/compat/memstream.h: In function ‘bt_open_memstream’: /home/simark/src/babeltrace/src/compat/memstream.h:257:15: error: implicit declaration of function ‘unlink’ [-Werror=implicit-function-declaration] 257 | ret = unlink(tmpname); | ^~~~~~ Fix that by including unistd.h. Change-Id: Iaa44bc51846a0b8c9e16fdc24d42aef0c5ad0aca Signed-off-by: Simon Marchi Reviewed-on: https://review.lttng.org/c/babeltrace/+/7107 Reviewed-by: Philippe Proulx --- diff --git a/src/compat/memstream.h b/src/compat/memstream.h index 35ffa643..30d974ca 100644 --- a/src/compat/memstream.h +++ b/src/compat/memstream.h @@ -224,6 +224,8 @@ error_free: #else /* __MINGW32__ */ +#include + /* * Fallback for systems which don't have open_memstream. Create FILE * * with bt_open_memstream, but require call to