Skip to content

Commit 9b0eaa9

Browse files
authored
Merge pull request #5 from SebaUbuntu/main
lib: Skip files that cannot be read
2 parents 82fbcca + 88bb30f commit 9b0eaa9

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/lib.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -116,7 +116,15 @@ fn get_dependencies(blob_paths: &[&PathBuf]) -> HashMap<String, Vec<String>> {
116116
.expect("Could not convert to string.")
117117
.to_owned();
118118

119-
let buffer = fs::read(&path).expect("Could not read path.");
119+
let buffer;
120+
match fs::read(&path) {
121+
Ok(b) => buffer = b,
122+
Err(_) => {
123+
eprintln!("Warning: Could not read file: {}", path.display());
124+
return;
125+
},
126+
}
127+
120128
let obj = goblin::Object::parse(&buffer);
121129

122130
if let Ok(Object::Elf(elf)) = obj {

0 commit comments

Comments
 (0)