Merge pull request #538 from fufesou/refact/ipc-trivial-changes

refact(ipc): trivial changes
This commit is contained in:
RustDesk
2026-05-16 17:48:28 +08:00
committed by GitHub
+3 -3
View File
@@ -175,7 +175,7 @@ pub fn is_service_ipc_postfix(postfix: &str) -> bool {
} }
// Keep Linux/macOS IPC parent directory rules in one place to avoid drift between // Keep Linux/macOS IPC parent directory rules in one place to avoid drift between
// `ipc_path()` and Linux-only `ipc_path_for_uid()`. // `ipc_path()` and Unix `ipc_path_for_uid()`.
#[cfg(any(target_os = "linux", target_os = "macos"))] #[cfg(any(target_os = "linux", target_os = "macos"))]
#[inline] #[inline]
fn ipc_parent_dir_for_uid(uid: u32, postfix: &str) -> String { fn ipc_parent_dir_for_uid(uid: u32, postfix: &str) -> String {
@@ -871,7 +871,7 @@ impl Config {
} }
} }
#[cfg(target_os = "linux")] #[cfg(any(target_os = "linux", target_os = "macos"))]
pub fn ipc_path_for_uid(uid: u32, postfix: &str) -> String { pub fn ipc_path_for_uid(uid: u32, postfix: &str) -> String {
let parent = ipc_parent_dir_for_uid(uid, postfix); let parent = ipc_parent_dir_for_uid(uid, postfix);
format!("{parent}/ipc{postfix}") format!("{parent}/ipc{postfix}")
@@ -3523,7 +3523,7 @@ mod tests {
} }
#[test] #[test]
#[cfg(target_os = "linux")] #[cfg(any(target_os = "linux", target_os = "macos"))]
fn test_uinput_ipc_path_is_shared_across_uids() { fn test_uinput_ipc_path_is_shared_across_uids() {
const ROOT_UID: u32 = 0; const ROOT_UID: u32 = 0;
const USER_UID: u32 = 1000; const USER_UID: u32 = 1000;