Fix: tests: fix unused-but-set warning in test_fd_tracker.c
[lttng-tools.git] / tests / unit / test_fd_tracker.c
index cb192ff80019d95b1932502c501f4882e9fbb533..de10f4fa5c2bad41f8723b3260b7c6259465b173 100644 (file)
@@ -54,6 +54,7 @@ const char file_contents[] = "Bacon ipsum dolor amet jerky drumstick sirloin "
        "Landjaeger tri-tip salami leberkas ball tip, ham hock chuck sausage "
        "flank jerky cupim. Pig bacon chuck pancetta andouille.";
 
+static
 void get_temporary_directories(char **_test_directory, char **_unlink_directory)
 {
        int ret;
@@ -76,6 +77,7 @@ void get_temporary_directories(char **_test_directory, char **_unlink_directory)
        }
 }
 
+static
 int fd_count(void)
 {
        DIR *dir;
@@ -158,7 +160,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;
@@ -167,7 +168,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);
        }
 }
 
@@ -327,7 +327,7 @@ int close_pipes(void *data, int *fds)
 
 /*
  * Validate that the tracker enforces the open file descriptor limit
- * when unsuspendable file descritptors are being opened.
+ * when unsuspendable file descriptors are being opened.
  */
 static
 void test_unsuspendable_limit(void)
@@ -347,7 +347,7 @@ void test_unsuspendable_limit(void)
 
        ret = fd_tracker_open_unsuspendable_fd(tracker, fds,
                        NULL, TRACKER_FD_LIMIT, open_pipes, NULL);
-       ok(ret == 0, "File descriptor tracker allowed the user to meet its limit with unsuspendable file descritptors (%d)",
+       ok(ret == 0, "File descriptor tracker allowed the user to meet its limit with unsuspendable file descriptors (%d)",
                        TRACKER_FD_LIMIT);
 
        ret = fd_tracker_open_unsuspendable_fd(tracker, &out_fd,
@@ -385,8 +385,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);
@@ -891,15 +893,15 @@ int main(int argc, char **argv)
        test_unsuspendable_duplicate();
        diag("Unsuspendable - closing an untracked file descriptor");
        test_unsuspendable_close_untracked();
-       diag("Unsuspendable - check that file descritptor limit is enforced");
+       diag("Unsuspendable - check that file descriptor limit is enforced");
        test_unsuspendable_limit();
 
-       diag("Suspendable - check that file descritptor limit is enforced");
+       diag("Suspendable - check that file descriptor limit is enforced");
        test_suspendable_limit();
        diag("Suspendable - restoration test");
        test_suspendable_restore();
 
-       diag("Mixed - check that file descritptor limit is enforced");
+       diag("Mixed - check that file descriptor limit is enforced");
        test_mixed_limit();
 
        diag("Suspendable - Unlinking test");
This page took 0.029512 seconds and 5 git commands to generate.