OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 gid_t ProcessInfo::SavedGroupID() const { | 103 gid_t ProcessInfo::SavedGroupID() const { |
104 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 104 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
105 return kern_proc_info_.kp_eproc.e_pcred.p_svgid; | 105 return kern_proc_info_.kp_eproc.e_pcred.p_svgid; |
106 } | 106 } |
107 | 107 |
108 std::set<gid_t> ProcessInfo::SupplementaryGroups() const { | 108 std::set<gid_t> ProcessInfo::SupplementaryGroups() const { |
109 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 109 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
110 | 110 |
111 const short ngroups = kern_proc_info_.kp_eproc.e_ucred.cr_ngroups; | 111 const short ngroups = kern_proc_info_.kp_eproc.e_ucred.cr_ngroups; |
112 DCHECK_GE(ngroups, 0); | 112 DCHECK_GE(ngroups, 0); |
113 DCHECK_LT(static_cast<size_t>(ngroups), | 113 DCHECK_LE(static_cast<size_t>(ngroups), |
114 arraysize(kern_proc_info_.kp_eproc.e_ucred.cr_groups)); | 114 arraysize(kern_proc_info_.kp_eproc.e_ucred.cr_groups)); |
115 | 115 |
116 const gid_t* groups = kern_proc_info_.kp_eproc.e_ucred.cr_groups; | 116 const gid_t* groups = kern_proc_info_.kp_eproc.e_ucred.cr_groups; |
117 return std::set<gid_t>(&groups[0], &groups[ngroups]); | 117 return std::set<gid_t>(&groups[0], &groups[ngroups]); |
118 } | 118 } |
119 | 119 |
120 std::set<gid_t> ProcessInfo::AllGroups() const { | 120 std::set<gid_t> ProcessInfo::AllGroups() const { |
121 INITIALIZATION_STATE_DCHECK_VALID(initialized_); | 121 INITIALIZATION_STATE_DCHECK_VALID(initialized_); |
122 | 122 |
123 std::set<gid_t> all_groups = SupplementaryGroups(); | 123 std::set<gid_t> all_groups = SupplementaryGroups(); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
224 // Not every argument was recovered. | 224 // Not every argument was recovered. |
225 LOG(ERROR) << "did not recover all arguments"; | 225 LOG(ERROR) << "did not recover all arguments"; |
226 return false; | 226 return false; |
227 } | 227 } |
228 | 228 |
229 argv->swap(local_argv); | 229 argv->swap(local_argv); |
230 return true; | 230 return true; |
231 } | 231 } |
232 | 232 |
233 } // namespace crashpad | 233 } // namespace crashpad |
OLD | NEW |