| 2216 | } |
| 2217 | |
| 2218 | struct ucred * |
| 2219 | crcopysafe(struct proc *p, struct ucred *cr) |
| 2220 | { |
| 2221 | struct ucred *oldcred; |
| 2222 | int groups; |
| 2223 | |
| 2224 | PROC_LOCK_ASSERT(p, MA_OWNED); |
| 2225 | |
| 2226 | oldcred = p->p_ucred; |
| 2227 | while (cr->cr_agroups < oldcred->cr_agroups) { |
| 2228 | groups = oldcred->cr_agroups; |
| 2229 | PROC_UNLOCK(p); |
| 2230 | crextend(cr, groups); |
| 2231 | PROC_LOCK(p); |
| 2232 | oldcred = p->p_ucred; |
| 2233 | } |
| 2234 | crcopy(cr, oldcred); |
| 2235 | |
| 2236 | return (oldcred); |
| 2237 | } |
| 2238 | |
| 2239 | /* |
| 2240 | * Extend the passed in credential to hold n items. |
no test coverage detected