Skip to content

Commit 0ae63ee

Browse files
cblichmanncopybara-github
authored andcommitted
Internal change
PiperOrigin-RevId: 734544977 Change-Id: Ib46a6c620464d6f3477e57e60781a7a76a8de0ec
1 parent 159d95f commit 0ae63ee

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

sandboxed_api/sandbox2/policybuilder.cc

+7-5
Original file line numberDiff line numberDiff line change
@@ -237,11 +237,13 @@ PolicyBuilder& PolicyBuilder::BlockSyscallWithErrno(uint32_t num, int error) {
237237
if (handled_syscalls_.insert(num).second &&
238238
blocked_syscalls_.insert(num).second) {
239239
user_policy_.insert(user_policy_.end(), {SYSCALL(num, ERRNO(error))});
240-
if (num == __NR_bpf) {
241-
user_policy_handles_bpf_ = true;
242-
}
243-
if (num == __NR_ptrace) {
244-
user_policy_handles_ptrace_ = true;
240+
switch (num) {
241+
case __NR_bpf:
242+
user_policy_handles_bpf_ = true;
243+
break;
244+
case __NR_ptrace:
245+
user_policy_handles_ptrace_ = true;
246+
break;
245247
}
246248
}
247249
return *this;

sandboxed_api/sandbox2/policybuilder.h

+1
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
#include <cstdint>
2222
#include <functional>
2323
#include <memory>
24+
#include <optional>
2425
#include <string>
2526
#include <type_traits>
2627
#include <utility>

0 commit comments

Comments
 (0)