From b1d676d3b5d2dbe5e0f50ed8b55ae2c2a559e68d Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sat, 8 Mar 2025 14:50:57 +0100 Subject: [PATCH] add missing unsafe around extern --- src/uu/hostid/src/hostid.rs | 2 +- src/uu/logname/src/logname.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/uu/hostid/src/hostid.rs b/src/uu/hostid/src/hostid.rs index 45532153b..921e9c724 100644 --- a/src/uu/hostid/src/hostid.rs +++ b/src/uu/hostid/src/hostid.rs @@ -13,7 +13,7 @@ const USAGE: &str = help_usage!("hostid.md"); const ABOUT: &str = help_about!("hostid.md"); // currently rust libc interface doesn't include gethostid -extern "C" { +unsafe extern "C" { pub fn gethostid() -> c_long; } diff --git a/src/uu/logname/src/logname.rs b/src/uu/logname/src/logname.rs index e9053571f..5437bbae3 100644 --- a/src/uu/logname/src/logname.rs +++ b/src/uu/logname/src/logname.rs @@ -9,7 +9,7 @@ use clap::Command; use std::ffi::CStr; use uucore::{error::UResult, format_usage, help_about, help_usage, show_error}; -extern "C" { +unsafe extern "C" { // POSIX requires using getlogin (or equivalent code) pub fn getlogin() -> *const libc::c_char; }