summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls/linux/socket_capability.cc
diff options
context:
space:
mode:
authorFabricio Voznika <fvoznika@google.com>2021-04-28 16:14:52 -0700
committergVisor bot <gvisor-bot@google.com>2021-04-28 16:22:24 -0700
commite1149179f3d5d7cbacb160d5bee6b00fe64a08ae (patch)
treebf1537c80ce62848d5f483212ebbb0e3f49bb540 /test/syscalls/linux/socket_capability.cc
parent704728d38fdb3ceaf8dfbfdba84eee183775b90c (diff)
Remove side effect from test cases
Restore capabilities for tests that need to change them. PiperOrigin-RevId: 371007047
Diffstat (limited to 'test/syscalls/linux/socket_capability.cc')
-rw-r--r--test/syscalls/linux/socket_capability.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/test/syscalls/linux/socket_capability.cc b/test/syscalls/linux/socket_capability.cc
index 84b5b2b21..f75482aba 100644
--- a/test/syscalls/linux/socket_capability.cc
+++ b/test/syscalls/linux/socket_capability.cc
@@ -40,7 +40,7 @@ TEST(SocketTest, UnixConnectNeedsWritePerm) {
// Drop capabilites that allow us to override permision checks. Otherwise if
// the test is run as root, the connect below will bypass permission checks
// and succeed unexpectedly.
- ASSERT_NO_ERRNO(SetCapability(CAP_DAC_OVERRIDE, false));
+ AutoCapability cap(CAP_DAC_OVERRIDE, false);
// Connect should fail without write perms.
ASSERT_THAT(chmod(addr.sun_path, 0500), SyscallSucceeds());