mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-27 19:17:43 +00:00
Merge pull request #8177 from cakebaker/logname_remove_unsafe_extern
logname: remove `unsafe extern "C"` block
This commit is contained in:
commit
fe7e769d6e
1 changed files with 1 additions and 6 deletions
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue