Fix faccessat(2) not supporting root access.
This commit is contained in:
parent
a6295e6d90
commit
c25f36cd53
1 changed files with 4 additions and 2 deletions
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright (c) 2011-2017 Jonas 'Sortie' Termansen.
|
||||
* Copyright (c) 2011-2017, 2021 Jonas 'Sortie' Termansen.
|
||||
*
|
||||
* Permission to use, copy, modify, and distribute this software for any
|
||||
* purpose with or without fee is hereby granted, provided that the above
|
||||
|
@ -216,7 +216,9 @@ int sys_faccessat(int dirfd, const char* path, int mode, int flags)
|
|||
if ( desc->stat(&kctx, &st) < 0 )
|
||||
return -1;
|
||||
mode_t mask;
|
||||
if ( kctx.uid == st.st_uid )
|
||||
if ( kctx.uid == 0 )
|
||||
mask = 0777;
|
||||
else if ( kctx.uid == st.st_uid )
|
||||
mask = 0700;
|
||||
else if ( kctx.gid == st.st_gid )
|
||||
mask = 0070;
|
||||
|
|
Loading…
Reference in a new issue