Compare commits
4 Commits
4c81516742
...
0.13.21
| Author | SHA1 | Date | |
|---|---|---|---|
|
e2c03842a3
|
|||
|
0fd66bff38
|
|||
|
0c4923016e
|
|||
|
e0c985f7ff
|
2
Makefile
2
Makefile
@@ -19,7 +19,7 @@ PREFIX ?= /usr/local
|
||||
# for conditionally compiling OS features
|
||||
OS != uname
|
||||
OS_INCLUDE != test -e include/$(OS).mk && printf 'include/$(OS).mk\n' \
|
||||
|| include/None.mk
|
||||
|| printf '/dev/null\n'
|
||||
|
||||
# normalized prefix
|
||||
PREFIX_N != dirname $(PREFIX)/.
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2023–2024 Emma Tebibyte <emma@tebibyte.media>
|
||||
* Copyright (c) 2024 DTB <trinity@trinity.moe>
|
||||
* SPDX-License-Identifier: CC0
|
||||
*
|
||||
* This work is marked with CC0 1.0. To view a copy of this license, visit
|
||||
@@ -10,7 +11,7 @@
|
||||
# include <unistd.h> /* pledge(2) */
|
||||
#endif
|
||||
|
||||
int main() {
|
||||
int main(void) {
|
||||
#ifdef __OpenBSD__
|
||||
pledge(NULL, NULL);
|
||||
#endif
|
||||
|
||||
@@ -34,7 +34,6 @@ use sysexits::EX_USAGE;
|
||||
#[cfg(target_os="openbsd")] use openbsd::{ Promises, pledge };
|
||||
#[cfg(target_os="openbsd")] use strerror::StrError;
|
||||
|
||||
|
||||
fn usage(s: &str) -> ExitCode {
|
||||
eprintln!("Usage: {} [-egl] integer integer...", s);
|
||||
ExitCode::from(EX_USAGE as u8)
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
*/
|
||||
|
||||
use std::{
|
||||
ffi::CString,
|
||||
ffi::{ CString, c_char },
|
||||
io::Error,
|
||||
ptr::null,
|
||||
};
|
||||
@@ -33,13 +33,13 @@ mod openbsd {
|
||||
}
|
||||
}
|
||||
|
||||
pub struct Promises(*const i8);
|
||||
pub struct Promises(*const c_char);
|
||||
|
||||
impl Promises {
|
||||
pub fn new(promises: &str) -> Self {
|
||||
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>,
|
||||
) -> Result<(), Error> {
|
||||
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
|
||||
.map(|p| p.0.into_raw() as *const i8)
|
||||
.map(|p| p.0.into_raw() as *const c_char)
|
||||
.unwrap_or(null());
|
||||
|
||||
unsafe {
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
/*
|
||||
* Copyright (c) 2023–2024 Emma Tebibyte <emma@tebibyte.media>
|
||||
* Copyright (c) 2024 DTB <trinity@trinity.moe>
|
||||
* SPDX-License-Identifier: CC0
|
||||
*
|
||||
* This work is marked with CC0 1.0. To view a copy of this license, visit
|
||||
@@ -10,7 +11,7 @@
|
||||
# include <unistd.h> /* pledge(2) */
|
||||
#endif
|
||||
|
||||
int main() {
|
||||
int main(void) {
|
||||
#ifdef __OpenBSD__
|
||||
pledge(NULL, NULL);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user