Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 9 additions & 3 deletions src/kerman.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ impl KernelInfo {

let out = Command::new(MOD_INFO_EXE).arg(name).output();
match out {
Ok(_) => match String::from_utf8(out.unwrap().stdout) {
Ok(output) => match String::from_utf8(output.stdout) {
Ok(data) => {
for line in data.lines().map(|el| el.replace(' ', "")) {
if line.starts_with("filename:/") && line.contains("/kernel/") {
Expand All @@ -194,9 +194,15 @@ impl KernelInfo {
}
}
}
Err(_) => todo!(),
Err(e) => {
// Failed to parse UTF-8 from modinfo output
eprintln!("Warning: Failed to parse modinfo output for '{}': {}", name, e);
}
},
Err(_) => todo!(),
Err(e) => {
// Failed to execute modinfo command
eprintln!("Warning: Failed to execute modinfo for '{}': {}", name, e);
}
}

name
Expand Down
6 changes: 3 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ pub fn get_kernel_infos(rootfs: Option<&str>) -> Result<Vec<KernelInfo>, Error>

let mut kernels: Vec<KernelInfo> = vec![];

for fres in read_dir(format!("{}{}", rfs_path.trim_end_matches("/"), MOD_D)).unwrap() {
let fd = fres.unwrap();
if fd.file_type().unwrap().is_dir() {
for fres in read_dir(format!("{}{}", rfs_path.trim_end_matches("/"), MOD_D))? {
let fd = fres?;
if fd.file_type()?.is_dir() {
let kinfo: KernelInfo =
KernelInfo::new(rfs_path, fd.path().file_name().unwrap().to_str().unwrap())?;
if kinfo.is_valid() {
Expand Down