diff options
author | John Baldwin <jhb@FreeBSD.org> | 2001-10-11 23:38:17 +0000 |
---|---|---|
committer | John Baldwin <jhb@FreeBSD.org> | 2001-10-11 23:38:17 +0000 |
commit | bd78cece5df2063d2e852bd6c895e05385eea931 (patch) | |
tree | d3ca87a8ac917d5003235cc737cd5f76591f7c1b /sys/kern/uipc_socket2.c | |
parent | 698166ca554d6cba78cd1728268fa03091697973 (diff) | |
download | src-bd78cece5df2063d2e852bd6c895e05385eea931.tar.gz src-bd78cece5df2063d2e852bd6c895e05385eea931.zip |
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.
Notes
Notes:
svn path=/head/; revision=84827
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 b0c23fdf84ab..c969e7dec9f9 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); |