mirror of
https://github.com/kata-containers/kata-containers.git
synced 2025-06-29 16:57:18 +00:00
agent/rustjail: Remove an unnecessary PathBuf
PathBuf is an owned, mutable Path. We don't need those properties in get_value_from_cgroup() so we can use a Path instead. This may be slightly safer, and definitely stops clippy (version 1.51 at least) from complaining. fixes #1611 Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
This commit is contained in:
parent
3c4485ece3
commit
6ce1e56d20
@ -8,7 +8,7 @@ use eventfd::{eventfd, EfdFlags};
|
|||||||
use nix::sys::eventfd;
|
use nix::sys::eventfd;
|
||||||
use std::fs::{self, File};
|
use std::fs::{self, File};
|
||||||
use std::os::unix::io::{AsRawFd, FromRawFd};
|
use std::os::unix::io::{AsRawFd, FromRawFd};
|
||||||
use std::path::{Path, PathBuf};
|
use std::path::Path;
|
||||||
|
|
||||||
use crate::pipestream::PipeStream;
|
use crate::pipestream::PipeStream;
|
||||||
use futures::StreamExt as _;
|
use futures::StreamExt as _;
|
||||||
@ -35,7 +35,7 @@ pub async fn notify_oom(cid: &str, cg_dir: String) -> Result<Receiver<String>> {
|
|||||||
// Flat keyed file format:
|
// Flat keyed file format:
|
||||||
// KEY0 VAL0\n
|
// KEY0 VAL0\n
|
||||||
// KEY1 VAL1\n
|
// KEY1 VAL1\n
|
||||||
fn get_value_from_cgroup(path: &PathBuf, key: &str) -> Result<i64> {
|
fn get_value_from_cgroup(path: &Path, key: &str) -> Result<i64> {
|
||||||
let content = fs::read_to_string(path)?;
|
let content = fs::read_to_string(path)?;
|
||||||
info!(
|
info!(
|
||||||
sl!(),
|
sl!(),
|
||||||
|
Loading…
Reference in New Issue
Block a user