summaryrefslogtreecommitdiffhomepage
path: root/test/syscalls/linux/chdir.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/chdir.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/chdir.cc')
-rw-r--r--test/syscalls/linux/chdir.cc4
1 files changed, 2 insertions, 2 deletions
diff --git a/test/syscalls/linux/chdir.cc b/test/syscalls/linux/chdir.cc
index 3182c228b..3c64b9eab 100644
--- a/test/syscalls/linux/chdir.cc
+++ b/test/syscalls/linux/chdir.cc
@@ -41,8 +41,8 @@ TEST(ChdirTest, Success) {
TEST(ChdirTest, PermissionDenied) {
// Drop capabilities that allow us to override directory permissions.
- ASSERT_NO_ERRNO(SetCapability(CAP_DAC_OVERRIDE, false));
- ASSERT_NO_ERRNO(SetCapability(CAP_DAC_READ_SEARCH, false));
+ AutoCapability cap1(CAP_DAC_OVERRIDE, false);
+ AutoCapability cap2(CAP_DAC_READ_SEARCH, false);
auto temp_dir = ASSERT_NO_ERRNO_AND_VALUE(
TempPath::CreateDirWith(GetAbsoluteTestTmpdir(), 0666 /* mode */));