Function nc::fchdir

source ·
pub unsafe fn fchdir(fd: i32) -> Result<(), Errno>
Expand description

Change working directory.

§Example

let path = "/tmp";
// Open folder directly.
let fd = unsafe { nc::openat(nc::AT_FDCWD, path, nc::O_PATH, 0) };
assert!(fd.is_ok());
let fd = fd.unwrap();
let ret = unsafe { nc::fchdir(fd) };
assert!(ret.is_ok());
let ret = unsafe { nc::close(fd) };
assert!(ret.is_ok());