mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-27 15:57:09 +00:00
rustjail: Do not unwrap potential error with cgroup manager
There can be an error while connecting to the cgroups managager, for example a `ENOENT` if a file is not found. Make sure that this is reported through the proper channels instead of causing a `panic()` that does not provide much information. Fixes: #6561 Signed-off-by: Christophe de Dinechin <dinechin@redhat.com> Reported-by: Greg Kurz <gkurz@redhat.com>
This commit is contained in:
parent
07e49c63e1
commit
41fdda1d84
@ -41,7 +41,7 @@ pub struct Manager {
|
||||
impl CgroupManager for Manager {
|
||||
fn apply(&self, pid: pid_t) -> Result<()> {
|
||||
let unit_name = self.unit_name.as_str();
|
||||
if self.dbus_client.unit_exist(unit_name).unwrap() {
|
||||
if self.dbus_client.unit_exist(unit_name)? {
|
||||
self.dbus_client.add_process(pid, self.unit_name.as_str())?;
|
||||
} else {
|
||||
self.dbus_client.start_unit(
|
||||
|
Loading…
Reference in New Issue
Block a user