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:
parent
8d6fb5fcb0
commit
ae6dcced08
1 changed files with 1 additions and 6 deletions
|
@ -10,14 +10,9 @@ use std::ffi::CStr;
|
||||||
use uucore::locale::get_message;
|
use uucore::locale::get_message;
|
||||||
use uucore::{error::UResult, show_error};
|
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> {
|
fn get_userlogin() -> Option<String> {
|
||||||
unsafe {
|
unsafe {
|
||||||
let login: *const libc::c_char = getlogin();
|
let login: *const libc::c_char = libc::getlogin();
|
||||||
if login.is_null() {
|
if login.is_null() {
|
||||||
None
|
None
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue