| OLD | NEW |
| (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 |
| OLD | NEW |