Skip to content

Commit

Permalink
removed duplicate code
Browse files Browse the repository at this point in the history
  • Loading branch information
Athul Muralidhar committed Aug 19, 2021
1 parent b9c8793 commit 62a5caf
Showing 1 changed file with 0 additions and 21 deletions.
21 changes: 0 additions & 21 deletions vm/src/stdlib/os.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3137,27 3137,6 @@ mod posix {
Ok(fd)
}

extern "C" {
fn ctermid(s: *mut libc::c_char) -> *mut libc::c_char;
}
#[pyfunction]
fn _ctermid(vm: &VirtualMachine) -> PyResult {
let returned = unsafe { ctermid(std::ptr::null_mut()) };
if returned.is_null() {
Err(errno_err(vm))
} else {
let returned = unsafe { ffi::CStr::from_ptr(returned) }.to_str().unwrap();
Ok(vm.ctx.new_str(returned))
}
}

#[pyfunction]
// fchdir is the same as os.chdir(file descriptor)
// also check out: https://docs.rs/libc/0.2.86/libc/fn.fchdir.html
fn fchchdir(path: PyPathLike, vm: &VirtualMachine) -> PyResult<()> {
env::set_current_dir(&path.path).map_err(|err| err.into_pyexception(vm))
}

pub(super) fn support_funcs() -> Vec<SupportFunc> {
vec![
SupportFunc::new("chmod", Some(false), Some(false), Some(false)),
Expand Down

0 comments on commit 62a5caf

Please sign in to comment.