Port: Add compat for dirfd
[babeltrace.git] / tests / lib / test_ctf_writer.c
index 0e4219c532281d016967e78e108036146ebac967..eb4b1b4def548be74949a7124f210425a6cacf45 100644 (file)
@@ -28,7 +28,7 @@
 #include <babeltrace/ctf-writer/event-fields.h>
 #include <babeltrace/ctf/events.h>
 #include <unistd.h>
-#include <stdlib.h>
+#include <babeltrace/compat/stdlib.h>
 #include <stdio.h>
 #include <sys/utsname.h>
 #include <babeltrace/compat/limits.h>
@@ -37,7 +37,7 @@
 #include <unistd.h>
 #include <sys/wait.h>
 #include <fcntl.h>
-#include <dirent.h>
+#include <babeltrace/compat/dirent.h>
 #include "tap/tap.h"
 
 #define METADATA_LINE_SIZE 512
@@ -728,7 +728,7 @@ int main(int argc, char **argv)
 
        plan_no_plan();
 
-       if (!mkdtemp(trace_path)) {
+       if (!bt_mkdtemp(trace_path)) {
                perror("# perror");
        }
 
@@ -756,7 +756,8 @@ int main(int argc, char **argv)
                NULL),
                "bt_ctf_writer_add_environment_field error with NULL field value");
 
-       if (uname(&name)) {
+       /* On Solaris, uname() can return any positive value on success */
+       if (uname(&name) < 0) {
                perror("uname");
                return -1;
        }
@@ -846,7 +847,7 @@ int main(int argc, char **argv)
        struct dirent *entry;
        while ((entry = readdir(trace_dir))) {
                if (entry->d_type == DT_REG) {
-                       unlinkat(dirfd(trace_dir), entry->d_name, 0);
+                       unlinkat(bt_dirfd(trace_dir), entry->d_name, 0);
                }
        }
 
This page took 0.023964 seconds and 4 git commands to generate.