Skip to content

Commit aa5265e

Browse files
committed
fix: refactor IPC file permissions assertion for Unix to improve clarity
1 parent 774f251 commit aa5265e

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

tests/test_start_permissions.rs

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,20 @@ mod tests {
4040
#[cfg(unix)]
4141
{
4242
use platform_lib::{S_IRWXU, S_IRWXG, S_IRWXO};
43-
let mask = (S_IRWXU | S_IRWXG | S_IRWXO) as u32;
43+
44+
let owner_perm = u32::from(S_IRWXU); // 用户权限 (rwx------ = 700)
45+
let group_perm = u32::from(S_IRWXG); // 组权限 (---rwx--- = 070)
46+
let other_perm = u32::from(S_IRWXO); // 其他权限 (------rwx = 007)
47+
let full_mask = owner_perm | group_perm | other_perm; // 完整权限掩码 (rwxrwxrwx = 777)
48+
49+
let actual_perms = permissions.mode() & full_mask;
50+
51+
debug!("IPC file permissions: {:o}", permissions.mode());
4452
assert_eq!(
45-
permissions.mode() & mask,
46-
mask,
47-
"IPC file permissions should be 777"
53+
actual_perms,
54+
full_mask,
55+
"IPC file permissions should be 777 (actual: {:o})",
56+
actual_perms
4857
);
4958
}
5059
#[cfg(windows)]

0 commit comments

Comments
 (0)