Skip to content

Commit

Permalink
fix: clippy::suspicious_open_options
Browse files Browse the repository at this point in the history
Signed-off-by: Martin Kröning <[email protected]>
  • Loading branch information
mkroening committed Apr 2, 2024
1 parent ca5fe17 commit 82918ad
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/create.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ pub fn create_container(
let mut file = OpenOptions::new()
.write(true)
.create(true)
.truncate(true)
.open(spec_path_backup)
.expect("Unable to write spec to backup file!");
file.write_all(serde_json::to_string(&container).unwrap().as_bytes())
Expand Down Expand Up @@ -345,6 +346,7 @@ pub fn create_container(
.read(true)
.write(true)
.create(true)
.truncate(true)
.open(state_location)
.expect("Could not create state-file in container dir!");
write!(state_file, "{pid}").expect("Could not write pid to state-file!");
Expand Down
1 change: 1 addition & 0 deletions src/devices.rs
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ fn mount_device(rootfs: &Path, destination_rel: &Path, major: u64, minor: u64) {
let _ = OpenOptions::new()
.mode(0o755)
.create(true)
.truncate(true)
.write(true)
.open(&destination)
.unwrap_or_else(|_| {
Expand Down
1 change: 1 addition & 0 deletions src/init.rs
Original file line number Diff line number Diff line change
Expand Up @@ -477,6 +477,7 @@ fn init_stage_child(args: SetupArgs) -> ! {
let mut sysctl_file = OpenOptions::new()
.mode(0o644)
.create(true)
.truncate(true)
.write(true)
.open(&full_path)
.unwrap_or_else(|_| panic!("Could not create sysctl entry at {:?}", full_path));
Expand Down
1 change: 1 addition & 0 deletions src/logging.rs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ pub fn init(
Some(
OpenOptions::new()
.create(true)
.truncate(true)
.write(true)
.open(project_dir.join(format!(
"log-{}.json",
Expand Down
2 changes: 2 additions & 0 deletions src/mounts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ pub fn mount_console(slave_path: &Path) {
let _ = OpenOptions::new()
.mode(0o666)
.create(true)
.truncate(true)
.write(true)
.read(true)
.open("/dev/console")
Expand Down Expand Up @@ -119,6 +120,7 @@ pub fn configure_mounts(
let _ = OpenOptions::new()
.mode(0o755)
.create(true)
.truncate(true)
.write(true)
.open(&destination_resolved)
.unwrap_or_else(|_| {
Expand Down

0 comments on commit 82918ad

Please sign in to comment.