Fix: sessiond: use after free
[lttng-tools.git] / tests / unit / test_fd_tracker.c
index c4248ed813059f5f768e0f013e0fc51ab1d46172..b185a95b1945d399e179d2a7adaf813cf424e0e0 100644 (file)
@@ -15,7 +15,6 @@
 #include <sys/types.h>
 #include <dirent.h>
 #include <stdio.h>
-#include <errno.h>
 #include <unistd.h>
 #include <fcntl.h>
 #include <sys/stat.h>
@@ -24,6 +23,7 @@
 #include <urcu.h>
 
 #include <common/compat/directory-handle.h>
+#include <common/compat/errno.h>
 #include <common/error.h>
 #include <common/fd-tracker/fd-tracker.h>
 
@@ -167,7 +167,6 @@ void untrack_std_fds(struct fd_tracker *tracker)
                { .fd = fileno(stdout), .name = "stdout" },
                { .fd = fileno(stderr), .name = "stderr" },
        };
-       unsigned int fds_set_to_minus_1 = 0;
 
        for (i = 0; i < sizeof(files) / sizeof(*files); i++) {
                int fd = files[i].fd;
@@ -176,7 +175,6 @@ void untrack_std_fds(struct fd_tracker *tracker)
 
                ok(ret == 0, "Untrack unsuspendable fd %d (%s)", fd,
                                files[i].name);
-               fds_set_to_minus_1 += (files[i].fd == -1);
        }
 }
 
@@ -394,8 +392,10 @@ void test_unsuspendable_close_untracked(void)
 
        ret = pipe(unknown_fds);
        assert(!ret);
-       assert(close(unknown_fds[0]) == 0);
-       assert(close(unknown_fds[1]) == 0);
+       ret = close(unknown_fds[0]);
+       assert(ret == 0);
+       ret = close(unknown_fds[1]);
+       assert(ret == 0);
 
        ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd,
                        NULL, 1, noop_open, &stdout_fd);
This page took 0.023978 seconds and 4 git commands to generate.