Skip to content

Commit

Permalink
Merge pull request #642 from Furisto/umask
Browse files Browse the repository at this point in the history
Support umask
  • Loading branch information
utam0k authored Jan 28, 2022
2 parents 8b0972b + c0bdf3d commit 2f1c8dc
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions crates/libcontainer/src/process/container_init_process.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ use crate::{
use anyhow::{bail, Context, Result};
use nix::mount::MsFlags;
use nix::sched::CloneFlags;
use nix::sys::stat::Mode;
use nix::unistd::setsid;

use nix::{
fcntl,
unistd::{self, Gid, Uid},
Expand Down Expand Up @@ -296,6 +298,14 @@ pub fn container_init_process(
)?
}

if let Some(umask) = proc.user().umask() {
if let Some(mode) = Mode::from_bits(umask) {
nix::sys::stat::umask(mode);
} else {
bail!("invalid umask {}", umask);
}
}

if let Some(paths) = linux.readonly_paths() {
// mount readonly path
for path in paths {
Expand Down

0 comments on commit 2f1c8dc

Please sign in to comment.