Function nc::unlinkat[][src]

pub fn unlinkat<P: AsRef<Path>>(
    dfd: i32,
    filename: P,
    flag: i32
) -> Result<(), Errno>
Expand description

Delete a name and possibly the file it refers to.

let path = "/tmp/nc-unlinkat";
let ret = nc::open(path, nc::O_WRONLY | nc::O_CREAT, 0o644);
assert!(ret.is_ok());
let fd = ret.unwrap();
assert!(nc::close(fd).is_ok());
// /tmp folder is not empty, so this call always returns error.
assert!(nc::unlinkat(nc::AT_FDCWD, path, nc::AT_REMOVEDIR).is_err());
assert!(nc::unlinkat(nc::AT_FDCWD, path, 0).is_ok());