forked from bonsai/harakit
libopenbsd.rs(3): makes using statically-allocated arrays possible
This commit is contained in:
parent
800a097903
commit
0b3ed37c38
@ -69,14 +69,12 @@ pub fn pledge(
|
|||||||
pub struct UnveilPerms(CString);
|
pub struct UnveilPerms(CString);
|
||||||
|
|
||||||
impl UnveilPerms {
|
impl UnveilPerms {
|
||||||
pub fn new(permissions: Vec<char>) -> Self {
|
pub fn new<T: IntoIterator<Item = char>>(permissions: T) -> Self {
|
||||||
if permissions.is_empty() {
|
let perms = CString::new(
|
||||||
return UnveilPerms(CString::new("").unwrap());
|
permissions.into_iter().collect::<String>()
|
||||||
}
|
).unwrap();
|
||||||
|
|
||||||
UnveilPerms(
|
UnveilPerms(perms)
|
||||||
CString::new(permissions.iter().collect::<String>()).unwrap()
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||