diff options
author | jhb <jhb@FreeBSD.org> | 2001-10-11 23:38:17 +0000 |
---|---|---|
committer | jhb <jhb@FreeBSD.org> | 2001-10-11 23:38:17 +0000 |
commit | 4806d88677d2a333254f9fc33d4e119cc56bb002 (patch) | |
tree | d3ca87a8ac917d5003235cc737cd5f76591f7c1b /sys/kern/uipc_socket2.c | |
parent | 9f68054d87b5538c76f0b802ef8f7344eedd5647 (diff) | |
download | FreeBSD-src-4806d88677d2a333254f9fc33d4e119cc56bb002.zip FreeBSD-src-4806d88677d2a333254f9fc33d4e119cc56bb002.tar.gz |
Change the kernel's ucred API as follows:
- crhold() returns a reference to the ucred whose refcount it bumps.
- crcopy() now simply copies the credentials from one credential to
another and has no return value.
- a new crshared() primitive is added which returns true if a ucred's
refcount is > 1 and false (0) otherwise.
Diffstat (limited to 'sys/kern/uipc_socket2.c')
-rw-r--r-- | sys/kern/uipc_socket2.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/sys/kern/uipc_socket2.c b/sys/kern/uipc_socket2.c index b0c23fd..c969e7d 100644 --- a/sys/kern/uipc_socket2.c +++ b/sys/kern/uipc_socket2.c @@ -240,8 +240,10 @@ sonewconn3(head, connstatus, td) so->so_state = head->so_state | SS_NOFDREF; so->so_proto = head->so_proto; so->so_timeo = head->so_timeo; - so->so_cred = td ? td->td_proc->p_ucred : head->so_cred; - crhold(so->so_cred); + if (td != NULL) + so->so_cred = crhold(td->td_proc->p_ucred); + else + so->so_cred = crhold(head->so_cred); if (soreserve(so, head->so_snd.sb_hiwat, head->so_rcv.sb_hiwat) || (*so->so_proto->pr_usrreqs->pru_attach)(so, 0, NULL)) { sodealloc(so); |