| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "sandbox/linux/syscall_broker/broker_client.h" | 5 #include "sandbox/linux/syscall_broker/broker_client.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <fcntl.h> | 8 #include <fcntl.h> |
| 9 #include <sys/stat.h> | 9 #include <sys/stat.h> |
| 10 #include <sys/socket.h> | 10 #include <sys/socket.h> |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 if (!quiet_failures_for_tests_) | 85 if (!quiet_failures_for_tests_) |
| 86 RAW_LOG(ERROR, "Could not make request to broker process"); | 86 RAW_LOG(ERROR, "Could not make request to broker process"); |
| 87 return -ENOMEM; | 87 return -ENOMEM; |
| 88 } | 88 } |
| 89 | 89 |
| 90 Pickle read_pickle(reinterpret_cast<char*>(reply_buf), msg_len); | 90 Pickle read_pickle(reinterpret_cast<char*>(reply_buf), msg_len); |
| 91 PickleIterator iter(read_pickle); | 91 PickleIterator iter(read_pickle); |
| 92 int return_value = -1; | 92 int return_value = -1; |
| 93 // Now deserialize the return value and eventually return the file | 93 // Now deserialize the return value and eventually return the file |
| 94 // descriptor. | 94 // descriptor. |
| 95 if (read_pickle.ReadInt(&iter, &return_value)) { | 95 if (iter.ReadInt(&return_value)) { |
| 96 switch (syscall_type) { | 96 switch (syscall_type) { |
| 97 case COMMAND_ACCESS: | 97 case COMMAND_ACCESS: |
| 98 // We should never have a fd to return. | 98 // We should never have a fd to return. |
| 99 RAW_CHECK(returned_fd == -1); | 99 RAW_CHECK(returned_fd == -1); |
| 100 return return_value; | 100 return return_value; |
| 101 case COMMAND_OPEN: | 101 case COMMAND_OPEN: |
| 102 if (return_value < 0) { | 102 if (return_value < 0) { |
| 103 RAW_CHECK(returned_fd == -1); | 103 RAW_CHECK(returned_fd == -1); |
| 104 return return_value; | 104 return return_value; |
| 105 } else { | 105 } else { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 135 return PathAndFlagsSyscall(COMMAND_ACCESS, pathname, mode); | 135 return PathAndFlagsSyscall(COMMAND_ACCESS, pathname, mode); |
| 136 } | 136 } |
| 137 | 137 |
| 138 int BrokerClient::Open(const char* pathname, int flags) const { | 138 int BrokerClient::Open(const char* pathname, int flags) const { |
| 139 return PathAndFlagsSyscall(COMMAND_OPEN, pathname, flags); | 139 return PathAndFlagsSyscall(COMMAND_OPEN, pathname, flags); |
| 140 } | 140 } |
| 141 | 141 |
| 142 } // namespace syscall_broker | 142 } // namespace syscall_broker |
| 143 | 143 |
| 144 } // namespace sandbox | 144 } // namespace sandbox |
| OLD | NEW |