Fix Capsicum syscalls test suite.

This commit is contained in:
Mariusz Zaborski 2016-08-30 19:58:41 +00:00
parent 66a5fa5d99
commit d7795033dd
2 changed files with 18 additions and 4 deletions

View File

@ -157,13 +157,16 @@ static void
fcntl_tests_1(int fd)
{
uint32_t fcntlrights;
cap_rights_t rights;
CHECK(cap_fcntls_limit(fd, CAP_FCNTL_GETFL) == 0);
fcntlrights = 0;
CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
CHECK(fcntlrights == CAP_FCNTL_GETFL);
CHECK(cap_rights_limit(fd, CAP_ALL & ~CAP_FCNTL) == 0);
CAP_ALL(&rights);
cap_rights_clear(&rights, CAP_FCNTL);
CHECK(cap_rights_limit(fd, &rights) == 0);
fcntlrights = CAP_FCNTL_ALL;
CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);
@ -206,8 +209,11 @@ static void
fcntl_tests_2(int fd)
{
uint32_t fcntlrights;
cap_rights_t rights;
CHECK(cap_rights_limit(fd, CAP_ALL & ~CAP_FCNTL) == 0);
CAP_ALL(&rights);
cap_rights_clear(&rights, CAP_FCNTL);
CHECK(cap_rights_limit(fd, &rights) == 0);
fcntlrights = CAP_FCNTL_ALL;
CHECK(cap_fcntls_get(fd, &fcntlrights) == 0);

View File

@ -131,6 +131,7 @@ static void
ioctl_tests_1(int fd)
{
unsigned long cmds[2];
cap_rights_t rights;
cmds[0] = FIOCLEX;
CHECK(cap_ioctls_limit(fd, cmds, 1) == 0);
@ -139,7 +140,10 @@ ioctl_tests_1(int fd)
CHECK(cmds[0] == FIOCLEX);
CHECK(cmds[1] == 0);
CHECK(cap_rights_limit(fd, CAP_ALL & ~CAP_IOCTL) == 0);
CAP_ALL(&rights);
cap_rights_clear(&rights, CAP_IOCTL);
CHECK(cap_rights_limit(fd, &rights) == 0);
CHECK(cap_ioctls_get(fd, cmds, nitems(cmds)) == 0);
cmds[0] = FIOCLEX;
@ -173,8 +177,12 @@ static void
ioctl_tests_2(int fd)
{
unsigned long cmds[2];
cap_rights_t rights;
CHECK(cap_rights_limit(fd, CAP_ALL & ~CAP_IOCTL) == 0);
CAP_ALL(&rights);
cap_rights_clear(&rights, CAP_IOCTL);
CHECK(cap_rights_limit(fd, &rights) == 0);
CHECK(cap_ioctls_get(fd, cmds, nitems(cmds)) == 0);
cmds[0] = FIOCLEX;