1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
#![allow(clippy::redundant_field_names)] #[macro_use] extern crate log; #[macro_use] extern crate error_chain; use std::ffi::CString; use std::path::Path; pub mod errors { error_chain! { foreign_links { Io(::std::io::Error) #[cfg(unix)]; } } } pub(crate) trait LibcString { fn as_libc(&self) -> (*const i8, CString); } impl LibcString for Path { fn as_libc(&self) -> (*const i8, CString) { let res = unsafe { use std::os::unix::ffi::OsStrExt; CString::from_vec_unchecked(self.as_os_str().as_bytes().to_vec()) }; (res.as_ptr() as *const i8, res) } } pub mod fd; pub mod dir; pub mod chroot; #[cfg(test)] extern crate libc; #[cfg(test)] extern crate tempdir; #[cfg(test)] extern crate env_logger; #[cfg(test)] #[path="tests/core.inc.rs"] mod test;