Skip to content

Commit

Permalink
Avoid except in smaps implementation
Browse files Browse the repository at this point in the history
The caller of this code handles errors gracefully but in this particular spot we
panic if the smaps file cannot be read to string. This is unfortunately a race
condition that we hit in practice.

Signed-off-by: Brian L. Troutwine <[email protected]>
  • Loading branch information
blt committed Feb 6, 2024
1 parent 28415bb commit f04836c
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lading/src/observer/memory.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@ impl Rollup {
let mut file: std::fs::File = std::fs::OpenOptions::new().read(true).open(path)?;

let mut contents = String::with_capacity(SMAP_SIZE_HINT);
file.read_to_string(&mut contents)
.expect("Failed to read contents into string");
file.read_to_string(&mut contents)?;

Self::from_str(&contents)
}
Expand Down

0 comments on commit f04836c

Please sign in to comment.