Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(487)

Unified Diff: sandbox/linux/seccomp-bpf/sandbox_bpf.cc

Issue 11103021: Seccomp BPF: handle EINTR in error reporting setup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 f7c85113db789ec1676bd967034a83f372413e45..bc7e682b1af5aace1c17967032312fb0007a44b2 100644
--- a/sandbox/linux/seccomp-bpf/sandbox_bpf.cc
+++ b/sandbox/linux/seccomp-bpf/sandbox_bpf.cc
@@ -84,11 +84,16 @@ bool Sandbox::RunFunctionInPolicy(void (*CodeInSandbox)(),
// Test a very simple sandbox policy to verify that we can
// successfully turn on sandboxing.
Die::EnableSimpleExit();
+ errno = 0;
if (HANDLE_EINTR(close(fds[0])) ||
- dup2(fds[1], 2) != 2 ||
+ HANDLE_EINTR(dup2(fds[1], 2)) != 2 ||
HANDLE_EINTR(close(fds[1]))) {
- static const char msg[] = "Failed to set up stderr\n";
- if (HANDLE_EINTR(write(fds[1], msg, sizeof(msg)-1))) { }
+ const char* error_string = strerror(errno);
+ static const char msg[] = "Failed to set up stderr: ";
+ if (HANDLE_EINTR(write(fds[1], msg, sizeof(msg)-1)) > 0 && error_string &&
+ HANDLE_EINTR(write(fds[1], error_string, strlen(error_string))) > 0 &&
+ HANDLE_EINTR(write(fds[1], "\n", 1))) {
+ }
} else {
evaluators_.clear();
setSandboxPolicy(syscallEvaluator, NULL);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698