Hello Martin,
On 7/31/24 02:34, Martin KaFai Lau wrote:
On 7/30/24 4:59 AM, Alexis Lothoré (eBPF Foundation) wrote:
+static void test_read(const char *path, char *buf, int buf_size, + int expected_ret) +{ + int ret, fd;
+ fd = open(path, O_RDONLY);
+ /* A bare open on unauthorized device should fail */ + if (expected_ret < 0) { + ASSERT_EQ(fd, expected_ret, "open file for read");
One nit. expected_ret is actually expected_errno. It just happens -EPERM is -1, so testing fd against expected_errno works here but is confusing to read. How about separating the fd and errno test in the access rejected case. First test for fd == -1 and then test for errno == expected_errno.
Ah you are right, I mixed up things here, I'll fix it.
Please also carry Stanislav's Ack in patch 1 and 3 in the next respin.
Sure, will do.
Thanks,
Alexis