Skip to content

Commit

Permalink
Merge pull request containers#579 from cgwalters/misc
Browse files Browse the repository at this point in the history
two minor patches + c9s compat
  • Loading branch information
cgwalters authored Dec 10, 2023
2 parents 0cf4a3b + 1457c20 commit 4e2eb8a
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
6 changes: 4 additions & 2 deletions src/efi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -454,15 +454,17 @@ pub(crate) fn clear_efi_current() -> Result<()> {
log::debug!("No EFI {BOOTCURRENT} found");
return Ok(());
};
log::debug!("EFI current: {current}");
let output = Command::new(EFIBOOTMGR)
.args(["-b", current, "-B"])
.output()?;
if !output.status.success() {
let st = output.status;
if !st.success() {
std::io::copy(
&mut std::io::Cursor::new(output.stderr),
&mut std::io::stderr().lock(),
)?;
anyhow::bail!("Failed to invoke {EFIBOOTMGR}");
anyhow::bail!("Failed to invoke {EFIBOOTMGR}: {st:?}");
}
anyhow::Ok(())
}
Expand Down
4 changes: 3 additions & 1 deletion src/filesystem.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
use std::io::Write;
use std::os::fd::AsRawFd;
use std::os::unix::process::CommandExt;
use std::process::Command;
Expand Down Expand Up @@ -27,12 +28,13 @@ pub(crate) fn inspect_filesystem(root: &openat::Dir, path: &str) -> Result<Files
// SAFETY: This is unsafe just for the pre_exec, when we port to cap-std we can use cap-std-ext
let o = unsafe {
Command::new("findmnt")
.args(["-J", "-v", "--output-all", path])
.args(["-J", "-v", "--output=SOURCE,FSTYPE,OPTIONS,UUID", path])
.pre_exec(move || nix::unistd::fchdir(rootfd).map_err(Into::into))
.output()?
};
let st = o.status;
if !st.success() {
let _ = std::io::stderr().write_all(&o.stderr)?;
anyhow::bail!("findmnt failed: {st:?}");
}
let o: Findmnt = serde_json::from_reader(std::io::Cursor::new(&o.stdout))
Expand Down

0 comments on commit 4e2eb8a

Please sign in to comment.