OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "ipc/ipc_channel_posix.h" | 5 #include "ipc/ipc_channel_posix.h" |
6 | 6 |
7 #include <errno.h> | 7 #include <errno.h> |
8 #include <fcntl.h> | 8 #include <fcntl.h> |
9 #include <stddef.h> | 9 #include <stddef.h> |
10 #include <sys/types.h> | 10 #include <sys/types.h> |
(...skipping 950 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
961 return true; | 961 return true; |
962 #elif defined(OS_SOLARIS) | 962 #elif defined(OS_SOLARIS) |
963 return false; | 963 return false; |
964 #else | 964 #else |
965 struct ucred cred; | 965 struct ucred cred; |
966 socklen_t cred_len = sizeof(cred); | 966 socklen_t cred_len = sizeof(cred); |
967 if (getsockopt(pipe_, SOL_SOCKET, SO_PEERCRED, &cred, &cred_len) != 0) { | 967 if (getsockopt(pipe_, SOL_SOCKET, SO_PEERCRED, &cred, &cred_len) != 0) { |
968 PLOG(ERROR) << "getsockopt " << pipe_; | 968 PLOG(ERROR) << "getsockopt " << pipe_; |
969 return false; | 969 return false; |
970 } | 970 } |
971 if (cred_len < sizeof(cred)) { | 971 if (static_cast<unsigned>(cred_len) < sizeof(cred)) { |
972 NOTREACHED() << "Truncated ucred from SO_PEERCRED?"; | 972 NOTREACHED() << "Truncated ucred from SO_PEERCRED?"; |
973 return false; | 973 return false; |
974 } | 974 } |
975 *client_euid = cred.uid; | 975 *client_euid = cred.uid; |
976 return true; | 976 return true; |
977 #endif | 977 #endif |
978 } | 978 } |
979 | 979 |
980 void Channel::ChannelImpl::ResetToAcceptingConnectionState() { | 980 void Channel::ChannelImpl::ResetToAcceptingConnectionState() { |
981 // Unregister libevent for the unix domain socket and close it. | 981 // Unregister libevent for the unix domain socket and close it. |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1253 } | 1253 } |
1254 | 1254 |
1255 #if defined(OS_LINUX) | 1255 #if defined(OS_LINUX) |
1256 // static | 1256 // static |
1257 void Channel::SetGlobalPid(int pid) { | 1257 void Channel::SetGlobalPid(int pid) { |
1258 ChannelImpl::SetGlobalPid(pid); | 1258 ChannelImpl::SetGlobalPid(pid); |
1259 } | 1259 } |
1260 #endif // OS_LINUX | 1260 #endif // OS_LINUX |
1261 | 1261 |
1262 } // namespace IPC | 1262 } // namespace IPC |
OLD | NEW |