mirror of
https://github.com/weyne85/rustdesk.git
synced 2025-10-29 17:00:05 +00:00
higher sysinfo version
This commit is contained in:
@@ -547,13 +547,13 @@ async fn check_pid(postfix: &str) {
|
||||
if let Ok(mut file) = File::open(&pid_file) {
|
||||
let mut content = String::new();
|
||||
file.read_to_string(&mut content).ok();
|
||||
let pid = content.parse::<i32>().unwrap_or(0);
|
||||
let pid = content.parse::<usize>().unwrap_or(0);
|
||||
if pid > 0 {
|
||||
use hbb_common::sysinfo::{ProcessExt, System, SystemExt};
|
||||
let mut sys = System::new();
|
||||
sys.refresh_processes();
|
||||
if let Some(p) = sys.process(pid.into()) {
|
||||
if let Some(current) = sys.process((std::process::id() as i32).into()) {
|
||||
if let Some(current) = sys.process((std::process::id() as usize).into()) {
|
||||
if current.name() == p.name() {
|
||||
// double check with connect
|
||||
if connect(1000, postfix).await.is_ok() {
|
||||
|
||||
@@ -581,7 +581,7 @@ fn check_main_window() -> bool {
|
||||
sys.refresh_processes();
|
||||
let app = format!("/Applications/{}.app", crate::get_app_name());
|
||||
let my_uid = sys
|
||||
.process((std::process::id() as i32).into())
|
||||
.process((std::process::id() as usize).into())
|
||||
.map(|x| x.user_id())
|
||||
.unwrap_or_default();
|
||||
for (_, p) in sys.processes().iter() {
|
||||
@@ -667,9 +667,6 @@ pub fn change_resolution(name: &str, width: usize, height: usize) -> ResultType<
|
||||
Ok(())
|
||||
}
|
||||
|
||||
|
||||
pub fn check_super_user_permission() -> ResultType<bool> {
|
||||
unsafe {
|
||||
Ok(MacCheckAdminAuthorization() == YES)
|
||||
}
|
||||
unsafe { Ok(MacCheckAdminAuthorization() == YES) }
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user