From 0954670a32efeaa4a5ffe1f24c9a31fe0ab6744c Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Thu, 7 Aug 2014 12:25:35 -0400 Subject: [PATCH] Use BABELTRACE_HOST_NAME_MAX in test_ctf_writer.c MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit This fixes the build on FreeBSD. Signed-off-by: Jérémie Galarneau Conflicts: tests/lib/test_ctf_writer.c --- tests/lib/test_ctf_writer.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/tests/lib/test_ctf_writer.c b/tests/lib/test_ctf_writer.c index 28ffae51..0e4219c5 100644 --- a/tests/lib/test_ctf_writer.c +++ b/tests/lib/test_ctf_writer.c @@ -31,7 +31,7 @@ #include #include #include -#include +#include #include #include #include @@ -715,10 +715,11 @@ int main(int argc, char **argv) char *metadata_string; struct bt_ctf_writer *writer; struct utsname name; - char hostname[HOST_NAME_MAX]; + char hostname[BABELTRACE_HOST_NAME_MAX]; struct bt_ctf_clock *clock; struct bt_ctf_stream_class *stream_class; struct bt_ctf_stream *stream1; + int ret; if (argc < 3) { printf("Usage: tests-ctf-writer path_to_ctf_parser_test path_to_babeltrace\n"); @@ -738,7 +739,10 @@ int main(int argc, char **argv) ok(writer, "bt_ctf_create succeeds in creating trace with path"); /* Add environment context to the trace */ - gethostname(hostname, HOST_NAME_MAX); + ret = gethostname(hostname, sizeof(hostname)); + if (ret < 0) { + return ret; + } ok(bt_ctf_writer_add_environment_field(writer, "host", hostname) == 0, "Add host (%s) environment field to writer instance", hostname); -- 2.34.1