Skip is_uid_include_group when GID available (#2292)

This can avoid an expensive computation which is 20% of test runtime.
This commit is contained in:
Andrew Gaul 2023-08-26 23:24:33 -07:00 committed by GitHub
parent ee49ca4abf
commit 82107f4b6c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 1 additions and 2 deletions

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;