Skip to content

Commit

Permalink
fixup! chroot: fix several group setting issues
Browse files Browse the repository at this point in the history
  • Loading branch information
jfinkels committed Jan 3, 2025
1 parent b4015b5 commit d2a7b1c
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/uu/chroot/src/chroot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -383,22 +383,25 @@ fn handle_missing_groups(strategy: Strategy) -> Result<(), ChrootError> {
} else {
set_supplemental_gids(&gids).map_err(ChrootError::SetGroupsFailed)
}
},
}
Strategy::FromUID(uid, true) => {
let gids = supplemental_gids(uid);
set_supplemental_gids(&gids).map_err(ChrootError::SetGroupsFailed)
},
}
}
}

/// Set supplemental groups for this process.
fn set_supplemental_gids_with_strategy(strategy: Strategy, groups: &Option<Vec<String>>) -> Result<(), ChrootError> {
fn set_supplemental_gids_with_strategy(
strategy: Strategy,
groups: &Option<Vec<String>>,
) -> Result<(), ChrootError> {
match groups {
None => handle_missing_groups(strategy),
Some(groups) => {
let mut gids = vec![];
for group in groups {
gids.push(name_to_gid(&group)?);
gids.push(name_to_gid(group)?);
}
set_supplemental_gids(&gids).map_err(ChrootError::SetGroupsFailed)
}
Expand Down

0 comments on commit d2a7b1c

Please sign in to comment.