Index: sandbox/linux/seccomp-bpf/sandbox_bpf.cc |
diff --git a/sandbox/linux/seccomp-bpf/sandbox_bpf.cc b/sandbox/linux/seccomp-bpf/sandbox_bpf.cc |
index b90a9ef5da085b591279b790a455288a17df75ed..a5da20e82f00da1079c37dc99da4224e47ee3970 100644 |
--- a/sandbox/linux/seccomp-bpf/sandbox_bpf.cc |
+++ b/sandbox/linux/seccomp-bpf/sandbox_bpf.cc |
@@ -886,10 +886,14 @@ Instruction* SandboxBPF::AssembleJumpTable(CodeGen* gen, |
} |
Instruction* SandboxBPF::RetExpression(CodeGen* gen, const ErrorCode& err) { |
- if (err.error_type_ == ErrorCode::ET_COND) { |
+ switch (err.error_type()) { |
+ case ErrorCode::ET_COND: |
return CondExpression(gen, err); |
rickyz (no longer on Chrome)
2014/09/16 22:36:46
nit: fix indent
mdempsky
2014/09/16 22:41:30
Oops, done.
|
- } else { |
- return gen->MakeInstruction(BPF_RET + BPF_K, err); |
+ case ErrorCode::ET_SIMPLE: |
+ case ErrorCode::ET_TRAP: |
+ return gen->MakeInstruction(BPF_RET + BPF_K, err.err()); |
+ default: |
+ SANDBOX_DIE("ErrorCode is not suitable for returning from a BPF program"); |
jln (very slow on Chromium)
2014/09/16 22:42:29
Will this work with all compilers? I think there a
mdempsky
2014/09/16 22:47:44
I think so. There are other functions in this fil
|
} |
} |