mirror of
https://github.com/rustdesk/hbb_common.git
synced 2026-05-19 08:10:18 +00:00
Merge pull request #538 from fufesou/refact/ipc-trivial-changes
refact(ipc): trivial changes
This commit is contained in:
+3
-3
@@ -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;
|
||||||
|
|||||||
Reference in New Issue
Block a user