Skip is_uid_include_group when GID available

This can avoid an expensive computation which is 20% of test runtime.
This commit is contained in:
Andrew Gaul 2023-08-26 09:55:21 -07:00
parent 48548f0896
commit caec776635

View File

@ -819,8 +819,7 @@ static int check_object_access(const char* path, int mask, struct stat* pstbuf)
}
if(pcxt->gid == obj_gid){
base_mask |= S_IRWXG;
}
if(1 == is_uid_include_group(pcxt->uid, obj_gid)){
} else if(1 == is_uid_include_group(pcxt->uid, obj_gid)){
base_mask |= S_IRWXG;
}
mode &= base_mask;