diff options
author | Alice Frosi <afrosi@redhat.com> | 2023-05-19 16:53:53 +0200 |
---|---|---|
committer | Alice Frosi <afrosi@redhat.com> | 2023-05-19 17:59:10 +0200 |
commit | ea0bdcf104654ec45d4a32055a4fb2573613ea16 (patch) | |
tree | 9f8266b06808957fd10aad610bdd43a649f26c4f /tests/unit/util.c | |
parent | 1f487f5a95f3fc9e9e9f4681436bfc8011d738aa (diff) | |
download | seitan-ea0bdcf104654ec45d4a32055a4fb2573613ea16.tar seitan-ea0bdcf104654ec45d4a32055a4fb2573613ea16.tar.gz seitan-ea0bdcf104654ec45d4a32055a4fb2573613ea16.tar.bz2 seitan-ea0bdcf104654ec45d4a32055a4fb2573613ea16.tar.lz seitan-ea0bdcf104654ec45d4a32055a4fb2573613ea16.tar.xz seitan-ea0bdcf104654ec45d4a32055a4fb2573613ea16.tar.zst seitan-ea0bdcf104654ec45d4a32055a4fb2573613ea16.zip |
filter: adjust filter build
Add filter_flush_args() to flush the arguments when finish to add the
syscall arguments.
Fixed test compilation after refactoring.
Diffstat (limited to 'tests/unit/util.c')
-rw-r--r-- | tests/unit/util.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/tests/unit/util.c b/tests/unit/util.c index 66448bb..4fee6e7 100644 --- a/tests/unit/util.c +++ b/tests/unit/util.c @@ -293,3 +293,17 @@ void ck_error_msg(char *s) ck_assert_msg(strstr(stderr_buff, s) != NULL, "err=\"%s\" doesn't contain \"%s\" ", stderr_buff, s); } + +int read_filter(struct sock_filter filter[], char *file) +{ + int fd, n; + + fd = open(file, O_CLOEXEC | O_RDONLY); + ck_assert_int_ge(fd, 0); + + n = read(fd, filter, sizeof(struct sock_filter) * MAX_FILTER); + ck_assert_int_ge(n, 0); + close(fd); + + return n / sizeof(struct sock_filter); +} |