mirror of
https://github.com/uutils/coreutils.git
synced 2026-06-10 15:48:22 -07:00
+1
-1
@@ -78,7 +78,7 @@ Each MODE is of the form '[ugoa]*([-+=]([rwxXst]*|[ugo]))+|[-+=]?[0-7]+'.",
|
||||
let recursive = matches.opt_present("recursive");
|
||||
let fmode = matches.opt_str("reference").and_then(|fref| {
|
||||
let mut stat : libc::stat = unsafe { mem::uninitialized() };
|
||||
let statres = unsafe { libc::stat(fref.as_ptr() as *const i8, &mut stat as *mut libc::stat) };
|
||||
let statres = unsafe { libc::stat(fref.as_ptr() as *const _, &mut stat as *mut libc::stat) };
|
||||
if statres == 0 {
|
||||
Some(stat.st_mode)
|
||||
} else {
|
||||
|
||||
+1
-1
@@ -191,7 +191,7 @@ fn pretty(possible_pw: Option<c_passwd>) {
|
||||
print!("uid\t{}\ngroups\t", pw_name);
|
||||
group(possible_pw, true);
|
||||
} else {
|
||||
let login = unsafe { String::from_utf8_lossy(CStr::from_ptr((getlogin() as *const i8)).to_bytes()).to_string() };
|
||||
let login = unsafe { String::from_utf8_lossy(CStr::from_ptr((getlogin() as *const _)).to_bytes()).to_string() };
|
||||
let rid = unsafe { getuid() };
|
||||
let pw = unsafe { getpwuid(rid) };
|
||||
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ extern {
|
||||
}
|
||||
|
||||
unsafe fn string_from_c_str(ptr: *const i8) -> String {
|
||||
String::from_utf8_lossy(CStr::from_ptr(ptr).to_bytes()).to_string()
|
||||
String::from_utf8_lossy(CStr::from_ptr(ptr as *const std::os::raw::c_char).to_bytes()).to_string()
|
||||
}
|
||||
|
||||
unsafe fn getuname() -> Uts {
|
||||
|
||||
@@ -128,7 +128,7 @@ pub fn get_pw_from_args(free: &Vec<String>) -> Option<c_passwd> {
|
||||
} else {
|
||||
let pw_pointer = unsafe {
|
||||
let cstr = CString::new(username).unwrap();
|
||||
getpwnam(cstr.as_bytes_with_nul().as_ptr() as *const i8)
|
||||
getpwnam(cstr.as_bytes_with_nul().as_ptr() as *const _)
|
||||
};
|
||||
if !pw_pointer.is_null() {
|
||||
Some(unsafe { read(pw_pointer) })
|
||||
|
||||
Reference in New Issue
Block a user