Skip to content

Commit bb2b6b8

Browse files
Johan-Liebert1allisonkarlitskaya
authored andcommitted
composefs-setup-root: Add context for errors
Signed-off-by: Pragyan Poudyal <[email protected]>
1 parent fca625f commit bb2b6b8

File tree

1 file changed

+8
-1
lines changed
  • crates/composefs-setup-root/src

1 file changed

+8
-1
lines changed

crates/composefs-setup-root/src/main.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
use std::{
22
ffi::OsString,
3+
fmt::Debug,
34
io::ErrorKind,
45
os::fd::{AsFd, OwnedFd},
56
path::{Path, PathBuf},
@@ -91,13 +92,16 @@ struct Args {
9192
}
9293

9394
// Helpers
94-
fn open_dir(dirfd: impl AsFd, name: impl AsRef<Path>) -> rustix::io::Result<OwnedFd> {
95+
fn open_dir(dirfd: impl AsFd, name: impl AsRef<Path> + Debug) -> rustix::io::Result<OwnedFd> {
9596
openat(
9697
dirfd,
9798
name.as_ref(),
9899
OFlags::PATH | OFlags::DIRECTORY | OFlags::CLOEXEC,
99100
Mode::empty(),
100101
)
102+
.inspect_err(|_| {
103+
eprintln!("Failed to open dir {name:?}");
104+
})
101105
}
102106

103107
fn ensure_dir(dirfd: impl AsFd, name: &str) -> rustix::io::Result<OwnedFd> {
@@ -116,6 +120,9 @@ fn bind_mount(fd: impl AsFd, path: &str) -> rustix::io::Result<OwnedFd> {
116120
| OpenTreeFlags::OPEN_TREE_CLOEXEC
117121
| OpenTreeFlags::AT_EMPTY_PATH,
118122
)
123+
.inspect_err(|_| {
124+
eprintln!("Open tree failed for {path}");
125+
})
119126
}
120127

121128
fn mount_tmpfs() -> Result<OwnedFd> {

0 commit comments

Comments
 (0)