tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: genfs_can_chtimes() (more duplicate code)



On Thu, Apr 30, 2009 at 2:54 AM, YAMAMOTO Takashi
<yamt%mwd.biglobe.ne.jp@localhost> wrote:

>>     1113 if (!issuperuser) {
>>     1114      if (euid != uid)
>>     1115              return EPERM;
>>     1116      if ((setattrflags & VA_UTIMES_NULL) == 0) {
>>     1117              error = VOP_ACCESS(vp, VWRITE, cred);
>>     1118              if (error)
>>     1119                      return error;
>>     1120      }
>>     1121 }
>>
>> ...only much uglier, in file-systems that are not udf. :)
>
> have you read "uglier" ones?
> at least ufs's one seems different and more correct.

What's different with the ufs version? that it doesn't rely on VA_UTIMES_NULL?

    588 if (kauth_cred_geteuid(cred) != ip->i_uid &&
    589     (error = kauth_authorize_generic(cred,
    590     KAUTH_GENERIC_ISSUSER, NULL)) &&
    591     ((vap->va_vaflags & VA_UTIMES_NULL) == 0 ||
    592     (error = VOP_ACCESS(vp, VWRITE, cred))))
    593         goto out;

Thanks,

-e.


Home | Main Index | Thread Index | Old Index