From: Jérémie Galarneau Date: Thu, 7 Aug 2014 16:25:35 +0000 (-0400) Subject: Use BABELTRACE_HOST_NAME_MAX in test_ctf_writer.c X-Git-Tag: v2.0.0-pre1~1506 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=22843b661cbcaaa58237822e1feed0607d5f29e3;hp=169e09d8c869b43996d9a1c7d771e42ae6294cbe Use BABELTRACE_HOST_NAME_MAX in test_ctf_writer.c This fixes the build on FreeBSD. Signed-off-by: Jérémie Galarneau --- diff --git a/tests/lib/test_ctf_writer.c b/tests/lib/test_ctf_writer.c index c6429331..89dfaa10 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 @@ -1406,7 +1406,7 @@ 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, *ret_clock; struct bt_ctf_stream_class *stream_class; struct bt_ctf_stream *stream1; @@ -1432,7 +1432,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);