fix check_process for empty arg since on mac, p.cmd() get "/Applications/RustDesk.app/Contents/MacOS/RustDesk", "XPC_SERVICE_NAME=com.carriez.RustDesk_server"

This commit is contained in:
rustdesk 2024-04-09 20:38:07 +08:00
parent 07ab8e508c
commit 178d33155f

View File

@ -1274,8 +1274,13 @@ pub fn check_process(arg: &str, mut same_uid: bool) -> bool {
if same_uid && p.user_id() != my_uid {
continue;
}
// on mac, p.cmd() get "/Applications/RustDesk.app/Contents/MacOS/RustDesk", "XPC_SERVICE_NAME=com.carriez.RustDesk_server"
let parg = if p.cmd().len() <= 1 { "" } else { &p.cmd()[1] };
if arg == parg {
if arg.is_empty() {
if !parg.starts_with("--") {
return true;
}
} else if arg == parg {
return true;
}
}