mirror of
https://github.com/containers/youki
synced 2024-06-19 01:59:47 +02:00
Fix compilation
Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
This commit is contained in:
parent
fd697a4886
commit
ec98e64f94
|
@ -198,21 +198,29 @@ impl<'a> ChildChannel<'a> {
|
|||
}
|
||||
|
||||
fn write_uid_mapping(&self, target_pid: Pid) -> Result<()> {
|
||||
let rootless = self.rootless.as_ref().unwrap();
|
||||
write_id_mapping(
|
||||
&format!("/proc/{}/uid_map", target_pid),
|
||||
rootless.uid_mappings,
|
||||
rootless.newuidmap.as_deref(),
|
||||
)
|
||||
if let Some(rootless) = self.rootless.as_ref() {
|
||||
if let Some(uid_mappings) = rootless.gid_mappings {
|
||||
return write_id_mapping(
|
||||
&format!("/proc/{}/uid_map", target_pid),
|
||||
uid_mappings,
|
||||
rootless.newuidmap.as_deref(),
|
||||
);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
fn write_gid_mapping(&self, target_pid: Pid) -> Result<()> {
|
||||
let rootless = self.rootless.as_ref().unwrap();
|
||||
write_id_mapping(
|
||||
&format!("/proc/{}/gid_map", target_pid),
|
||||
rootless.gid_mappings,
|
||||
rootless.newgidmap.as_deref(),
|
||||
)
|
||||
if let Some(rootless) = self.rootless.as_ref() {
|
||||
if let Some(gid_mappings) = rootless.gid_mappings {
|
||||
return write_id_mapping(
|
||||
&format!("/proc/{}/gid_map", target_pid),
|
||||
gid_mappings,
|
||||
rootless.newgidmap.as_deref(),
|
||||
);
|
||||
}
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -13,9 +13,9 @@ pub struct Rootless<'a> {
|
|||
/// Location of the newgidmap binary
|
||||
pub newgidmap: Option<PathBuf>,
|
||||
/// Mappings for user ids
|
||||
pub uid_mappings: &'a Vec<LinuxIdMapping>,
|
||||
pub uid_mappings: Option<&'a Vec<LinuxIdMapping>>,
|
||||
/// Mappings for group ids
|
||||
pub gid_mappings: &'a Vec<LinuxIdMapping>,
|
||||
pub gid_mappings: Option<&'a Vec<LinuxIdMapping>>,
|
||||
}
|
||||
|
||||
impl<'a> From<&'a Linux> for Rootless<'a> {
|
||||
|
@ -23,8 +23,8 @@ impl<'a> From<&'a Linux> for Rootless<'a> {
|
|||
Self {
|
||||
newuidmap: None,
|
||||
newgidmap: None,
|
||||
uid_mappings: linux.uid_mappings.as_ref().unwrap_or(&vec![]).clone(),
|
||||
gid_mappings: linux.gid_mappings.as_ref().unwrap_or(&vec![]).clone(),
|
||||
uid_mappings: linux.uid_mappings.as_ref(),
|
||||
gid_mappings: linux.gid_mappings.as_ref(),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue