mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-25 15:02:45 +00:00
agent: remove unwrap()
for e.as_errno()
Use `{:?}` to print `e.as_errno()` instead of using `{}` to print `e.as_errno().unwrap().desc()`. Avoid panic only caused by error's content. Signed-off-by: Tim Zhang <tim@hyper.sh>
This commit is contained in:
parent
e77482fe16
commit
6ba294a11e
@ -397,7 +397,7 @@ fn do_init_child(cwfd: RawFd) -> Result<()> {
|
|||||||
ns.r#type.clone(),
|
ns.r#type.clone(),
|
||||||
ns.path.clone()
|
ns.path.clone()
|
||||||
);
|
);
|
||||||
log_child!(cfd_log, "error is : {}", e.as_errno().unwrap().desc());
|
log_child!(cfd_log, "error is : {:?}", e.as_errno());
|
||||||
e
|
e
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
@ -1080,7 +1080,7 @@ fn get_pid_namespace(logger: &Logger, linux: &Linux) -> Result<Option<RawFd>> {
|
|||||||
ns.r#type.clone(),
|
ns.r#type.clone(),
|
||||||
ns.path.clone()
|
ns.path.clone()
|
||||||
);
|
);
|
||||||
error!(logger, "error is : {}", e.as_errno().unwrap().desc());
|
error!(logger, "error is : {:?}", e.as_errno());
|
||||||
|
|
||||||
e
|
e
|
||||||
})?;
|
})?;
|
||||||
|
@ -712,9 +712,9 @@ fn mount_from(
|
|||||||
let _ = stat::stat(dest.as_str()).map_err(|e| {
|
let _ = stat::stat(dest.as_str()).map_err(|e| {
|
||||||
log_child!(
|
log_child!(
|
||||||
cfd_log,
|
cfd_log,
|
||||||
"dest stat error. {}: {}",
|
"dest stat error. {}: {:?}",
|
||||||
dest.as_str(),
|
dest.as_str(),
|
||||||
e.as_errno().unwrap().desc()
|
e.as_errno()
|
||||||
)
|
)
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -726,7 +726,7 @@ fn mount_from(
|
|||||||
Some(d.as_str()),
|
Some(d.as_str()),
|
||||||
)
|
)
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
log_child!(cfd_log, "mount error: {}", e.as_errno().unwrap().desc());
|
log_child!(cfd_log, "mount error: {:?}", e.as_errno());
|
||||||
e
|
e
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
@ -748,12 +748,7 @@ fn mount_from(
|
|||||||
None::<&str>,
|
None::<&str>,
|
||||||
)
|
)
|
||||||
.map_err(|e| {
|
.map_err(|e| {
|
||||||
log_child!(
|
log_child!(cfd_log, "remout {}: {:?}", dest.as_str(), e.as_errno());
|
||||||
cfd_log,
|
|
||||||
"remout {}: {}",
|
|
||||||
dest.as_str(),
|
|
||||||
e.as_errno().unwrap().desc()
|
|
||||||
);
|
|
||||||
e
|
e
|
||||||
})?;
|
})?;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user