libopenbsd.rs(3): uses c_char instead of i8 for portability
This commit is contained in:
parent
4c81516742
commit
e0c985f7ff
@ -17,7 +17,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
use std::{
|
use std::{
|
||||||
ffi::CString,
|
ffi::{ CString, c_char },
|
||||||
io::Error,
|
io::Error,
|
||||||
ptr::null,
|
ptr::null,
|
||||||
};
|
};
|
||||||
@ -33,13 +33,13 @@ mod openbsd {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub struct Promises(*const i8);
|
pub struct Promises(*const c_char);
|
||||||
|
|
||||||
impl Promises {
|
impl Promises {
|
||||||
pub fn new(promises: &str) -> Self {
|
pub fn new(promises: &str) -> Self {
|
||||||
let p = CString::new(promises).unwrap();
|
let p = CString::new(promises).unwrap();
|
||||||
|
|
||||||
Promises(p.into_raw() as *const i8)
|
Promises(p.into_raw() as *const c_char)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -81,10 +81,10 @@ pub fn unveil(
|
|||||||
permissions: Option<UnveilPerms>,
|
permissions: Option<UnveilPerms>,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
let path_c = path.map(CString::new).map(Result::unwrap);
|
let path_c = path.map(CString::new).map(Result::unwrap);
|
||||||
let arg1 = path_c.map(|p| p.into_raw() as *const i8).unwrap_or(null());
|
let arg1 = path_c.map(|p| p.into_raw() as *const c_char).unwrap_or(null());
|
||||||
|
|
||||||
let arg2 = permissions
|
let arg2 = permissions
|
||||||
.map(|p| p.0.into_raw() as *const i8)
|
.map(|p| p.0.into_raw() as *const c_char)
|
||||||
.unwrap_or(null());
|
.unwrap_or(null());
|
||||||
|
|
||||||
unsafe {
|
unsafe {
|
||||||
|
Loading…
Reference in New Issue
Block a user