(args: SymlinkArgs<'_>, vm: &VirtualMachine)
| 542 | |
| 543 | #[pyfunction] |
| 544 | pub(super) fn symlink(args: SymlinkArgs<'_>, vm: &VirtualMachine) -> PyResult<()> { |
| 545 | let src = args.src.into_cstring(vm)?; |
| 546 | let dst = args.dst.into_cstring(vm)?; |
| 547 | #[cfg(not(target_os = "redox"))] |
| 548 | { |
| 549 | nix::unistd::symlinkat(&*src, args.dir_fd.get(), &*dst) |
| 550 | .map_err(|err| err.into_pyexception(vm)) |
| 551 | } |
| 552 | #[cfg(target_os = "redox")] |
| 553 | { |
| 554 | let [] = args.dir_fd.0; |
| 555 | let res = unsafe { libc::symlink(src.as_ptr(), dst.as_ptr()) }; |
| 556 | if res < 0 { |
| 557 | Err(vm.new_last_errno_error()) |
| 558 | } else { |
| 559 | Ok(()) |
| 560 | } |
| 561 | } |
| 562 | } |
| 563 | |
| 564 | #[pyfunction] |
| 565 | #[pyfunction(name = "unlink")] |
nothing calls this directly
no test coverage detected