Use BABELTRACE_HOST_NAME_MAX in test_ctf_writer.c
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 7 Aug 2014 16:25:35 +0000 (12:25 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 7 Aug 2014 18:27:44 +0000 (14:27 -0400)
This fixes the build on FreeBSD.

Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
tests/lib/test_ctf_writer.c

index c6429331b0d4e29e5a579d084b885f7fcbb98a66..89dfaa10c3d303e9ac8c72c913d20a97a39dcb4d 100644 (file)
@@ -31,7 +31,7 @@
 #include <stdlib.h>
 #include <stdio.h>
 #include <sys/utsname.h>
-#include <limits.h>
+#include <babeltrace/compat/limits.h>
 #include <string.h>
 #include <assert.h>
 #include <unistd.h>
@@ -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);
This page took 0.027282 seconds and 4 git commands to generate.