mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
id: The --real
flag should only affect -u
, -g
, and -G
(#7796)
* id: The `--real` flag should only affect `-u`, `-g`, and `-U` * id: Test output with different UID and EUID * id: Simplify testing different UID and EUID * id: Compile preload file for test using cc instead of gcc * id: Remove test for different UID and EUID The test is incompatible with some CI/CD targets. This reverts the following commits: - 8efcbf9adae59b7074d29b2ac8ff8a4083df7d95 - 208fa8e7f88f29214ef99984bf47c6a9ebc2ed0d - a498a2722d7ab56ce96e7cab4766343930ea85ac
This commit is contained in:
parent
5909315d1c
commit
d3a2db415c
1 changed files with 8 additions and 4 deletions
|
@ -238,10 +238,14 @@ pub fn uumain(args: impl uucore::Args) -> UResult<()> {
|
|||
return Ok(());
|
||||
}
|
||||
|
||||
let (uid, gid) = possible_pw.as_ref().map(|p| (p.uid, p.gid)).unwrap_or((
|
||||
if state.rflag { getuid() } else { geteuid() },
|
||||
if state.rflag { getgid() } else { getegid() },
|
||||
));
|
||||
let (uid, gid) = possible_pw.as_ref().map(|p| (p.uid, p.gid)).unwrap_or({
|
||||
let use_effective = !state.rflag && (state.uflag || state.gflag || state.gsflag);
|
||||
if use_effective {
|
||||
(geteuid(), getegid())
|
||||
} else {
|
||||
(getuid(), getgid())
|
||||
}
|
||||
});
|
||||
state.ids = Some(Ids {
|
||||
uid,
|
||||
gid,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue