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

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

Issue 11203003: Merge 161443 - Seccomp BPF: handle EINTR in error reporting setup. (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1271/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
===================================================================
--- sandbox/linux/seccomp-bpf/sandbox_bpf.cc (revision 162733)
+++ sandbox/linux/seccomp-bpf/sandbox_bpf.cc (working copy)
@@ -84,11 +84,16 @@
// 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