From 516bf0a77e025cfccce2fa400b757e94dc0bf1d8 Mon Sep 17 00:00:00 2001 From: Simon Marchi Date: Sat, 22 Jan 2022 20:37:19 -0500 Subject: [PATCH] compat: fix compilation with !BABELTRACE_HAVE_OPEN_MEMSTREAM MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 --- src/compat/memstream.h | 2 ++ 1 file changed, 2 insertions(+) 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 -- 2.34.1