Subject: Re: commoning up code that changes uids and gids
To: Luke Mewburn <lukem@netbsd.org>
From: Lennart Augustsson <lennart@augustsson.net>
List: tech-kern
Date: 03/27/2003 19:22:50
Luke Mewburn wrote:

>On Sun, Mar 09, 2003 at 07:19:29PM +0000, David Laight wrote:
>  | > Also, you didn't adress the issue I raised - that ruid
>  | > in sys_setreuid() is always set to as 'p->p_cred->p_ruid ? -1 : euid;',
>  | > so the previous 'if (ruid == -1) ruid = p->p_cred->p_ruid;' has
>  | > no effect. Other routines might have similar issues.
>  | 
>  | svuid = ruid == p->p_cred->p_ruid ? -1 : euid;
>  | 
>  | Is an assignment to svuid, not ruid.
>
>Seeing as this did cause more confusion that it's worth, could you
>just add a couple of parenthesis.  E.g;
>	svuid = (ruid == p->p_cred->p_ruid ? -1 : euid);
>or
>	svuid = (ruid == p->p_cred->p_ruid) ? -1 : euid;
>
To me those extra parens just make it less readable.

    -- Lennart