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

Side by Side Diff: sandbox/linux/seccomp-bpf/die.cc

Issue 10833044: Refactored ErrorCode into it's own class (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Added unittest (and new framework to make this possible) Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "sandbox/linux/seccomp-bpf/die.h"
6
7
8 namespace playground2 {
9
10 bool Die::CallHandler(const char *msg, const char *file, int line) {
11 if (!HasCustomHandler()) {
12 return false;
13 }
14 handlers_.back()(msg, file, line);
15 return true;
16 }
17
18 void Die::LogToStderr(const char *msg, const char *file, int line) {
19 if (msg) {
20 char buf[40];
21 sprintf(buf, "%d", line);
22 std::string s = std::string(file) + ":" + buf + ":" + msg + "\n";
23 if (HANDLE_EINTR(write(2, s.c_str(), s.length()))) { }
24 }
25 }
26
27 std::vector<Die::Handler> Die::handlers_;
28
29 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698