svn commit: r342599 - head/sys/kern

John Baldwin jhb at FreeBSD.org
Tue Jan 1 01:15:28 UTC 2019


On 12/29/18 1:36 PM, Kristof Provost wrote:
> Author: kp
> Date: Sat Dec 29 21:36:02 2018
> New Revision: 342599
> URL: https://svnweb.freebsd.org/changeset/base/342599
> 
> Log:
>   Simplify jail ID printing on process exit
>   
>   As suggested by kib@, we don't need to check p_ucred, because that's only NULL
>   during process creation, and cr_prison is never NULL.
> 
> Modified:
>   head/sys/kern/kern_sig.c
> 
> Modified: head/sys/kern/kern_sig.c
> ==============================================================================
> --- head/sys/kern/kern_sig.c	Sat Dec 29 21:18:01 2018	(r342598)
> +++ head/sys/kern/kern_sig.c	Sat Dec 29 21:36:02 2018	(r342599)
> @@ -3094,16 +3094,12 @@ proc_wkilled(struct proc *p)
>  void
>  killproc(struct proc *p, char *why)
>  {
> -	int jid = -1;
>  
> -	if (p->p_ucred && p->p_ucred->cr_prison)
> -		jid = p->p_ucred->cr_prison->pr_id;
> -
>  	PROC_LOCK_ASSERT(p, MA_OWNED);
>  	CTR3(KTR_PROC, "killproc: proc %p (pid %d, %s)", p, p->p_pid,
>  	    p->p_comm);
>  	log(LOG_ERR, "pid %d (%s), jid %d, uid %d, was killed: %s\n",
> -	    p->p_pid, p->p_comm, jid,
> +	    p->p_pid, p->p_comm, p->p_ucred->cr_prison->pr_id,
>  	    p->p_ucred ? p->p_ucred->cr_uid : -1, why);

Could you fix the cr_uid cases to remove the ?: as a follow up?

-- 
John Baldwin

                                                                            


More information about the svn-src-head mailing list