devela::_dep::nc

Function access

pub unsafe fn access<P>(filename: P, mode: i32) -> Result<(), i32> 
where P: AsRef<Path>,
Available on crate feature dep_nc only.
Expand description

Check user’s permission for a file.

It uses the real user ID and the group access list to authorize the request.

§Examples

let ret = unsafe { nc::access("/etc/passwd", nc::F_OK) };
assert!(ret.is_ok());
let ret = unsafe { nc::access("/etc/passwd", nc::X_OK) };
assert!(ret.is_err());