nohup: remove unsafe stub

This commit is contained in:
oech3
2026-05-03 09:16:41 +09:00
committed by Daniel Hofstetter
parent af09954d5a
commit a1aa3b97eb
+3 -7
View File
@@ -35,6 +35,7 @@ mod options {
#[derive(Debug, Error)]
enum NohupError {
#[cfg(target_vendor = "apple")]
#[error("{}", translate!("nohup-error-cannot-detach"))]
CannotDetach,
@@ -50,6 +51,7 @@ enum NohupError {
impl UError for NohupError {
fn code(&self) -> i32 {
#[allow(clippy::match_wildcard_for_single_variants)]
match self {
Self::OpenFailed(code, _) | Self::OpenFailed2(code, _, _, _) => *code,
_ => 2,
@@ -77,6 +79,7 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
unsafe { libc::signal(libc::SIGHUP, libc::SIG_IGN) };
#[cfg(target_vendor = "apple")]
if unsafe { !_vprocmgr_detach_from_console(0).is_null() } {
return Err(NohupError::CannotDetach.into());
}
@@ -176,10 +179,3 @@ fn find_stdout() -> UResult<File> {
unsafe extern "C" {
fn _vprocmgr_detach_from_console(flags: u32) -> *const libc::c_int;
}
#[cfg(not(target_vendor = "apple"))]
/// # Safety
/// This function is unsafe because it dereferences a raw pointer.
unsafe fn _vprocmgr_detach_from_console(_: u32) -> *const libc::c_int {
std::ptr::null()
}