Skip to content

Commit

Permalink
only one err for io fail
Browse files Browse the repository at this point in the history
  • Loading branch information
workingjubilee committed Jul 7, 2023
1 parent dca80ea commit e48b001
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/symbolize/gimli/parse_running_mmaps_unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,14 @@ pub(super) struct MapsEntry {
}

pub(super) fn parse_maps() -> Result<Vec<MapsEntry>, &'static str> {
let failed_io_err = "couldn't read /proc/self/maps";
let mut v = Vec::new();
let mut proc_self_maps =
File::open("/proc/self/maps").map_err(|_| "Couldn't open /proc/self/maps")?;
File::open("/proc/self/maps").map_err(|_| failed_io_err)?;
let mut buf = String::new();
let _bytes_read = proc_self_maps
.read_to_string(&mut buf)
.map_err(|_| "Couldn't read /proc/self/maps")?;
.map_err(|_| failed_io_err)?;
for line in buf.lines() {
v.push(line.parse()?);
}
Expand Down

0 comments on commit e48b001

Please sign in to comment.