Re: Bug in comment ;-) net/core/scm.c

Riccardo Facchetti (fizban@mbox.vol.it)
Fri, 18 Apr 1997 18:50:32 +0200 (MET DST)


On Fri, 18 Apr 1997, Pavel Machek wrote:

> Hi!
> Look at following piece of code,
> /*
> * Only allow a user to send credentials, that they could set with
> * setu(g)id.
> */
>
> static __inline__ int scm_check_creds(struct ucred *creds)
> {
> if (suser())
> return 0;
>
> and decide whether word "super" should not be added into comment.

This chunk of code means that if you are suser() return 0 immediately.
The function returs 0 to mean OK.

Then check the user u(g)ids against creds and return error if they don't
match.
In other words the function look like:

if (you are suser)
return OK
else
if (creds don't match u(g)id)
return ERROR
else
return OK

I think the word "super" should not be added.

Tip: don't judge a piece of code without have a view of the entire
context.

Ciao,
Riccardo.