mirror of
https://github.com/uutils/coreutils.git
synced 2025-12-23 08:47:37 +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: -8efcbf9ada-208fa8e7f8-a498a2722d
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