From f04836c74aa40705f92a3572c9dc7181946e65fe Mon Sep 17 00:00:00 2001 From: "Brian L. Troutwine" Date: Tue, 6 Feb 2024 14:21:32 -0800 Subject: [PATCH] Avoid except in smaps implementation 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 --- lading/src/observer/memory.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lading/src/observer/memory.rs b/lading/src/observer/memory.rs index 18d20f4ac..589dad291 100644 --- a/lading/src/observer/memory.rs +++ b/lading/src/observer/memory.rs @@ -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) }