ksud: respect the kernel default uid

This commit is contained in:
weishu
2023-06-04 18:09:58 +08:00
parent 33aa6de50b
commit 019da4a634

View File

@@ -168,7 +168,8 @@ pub fn root_shell() -> Result<()> {
free_idx += 1;
}
let mut uid = 0; // default uid = 0(root)
// use current uid if no user specified, these has been done in kernel!
let mut uid = unsafe { libc::getuid() };
if free_idx < matches.free.len() {
let name = &matches.free[free_idx];
uid = unsafe {