1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 03:27:44 +00:00

logname: remove 'unsafe extern "C"' block

This commit is contained in:
Daniel Hofstetter 2025-06-14 10:42:37 +02:00
parent 8d6fb5fcb0
commit ae6dcced08

View file

@ -10,14 +10,9 @@ use std::ffi::CStr;
use uucore::locale::get_message;
use uucore::{error::UResult, show_error};
unsafe extern "C" {
// POSIX requires using getlogin (or equivalent code)
pub fn getlogin() -> *const libc::c_char;
}
fn get_userlogin() -> Option<String> {
unsafe {
let login: *const libc::c_char = getlogin();
let login: *const libc::c_char = libc::getlogin();
if login.is_null() {
None
} else {