File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change 33// general purpose, but it hasn't been tested elsewhere.
44
55use super :: mystd:: fs:: File ;
6- use super :: mystd:: io:: { BufRead , BufReader } ;
6+ use super :: mystd:: io:: Read ;
77use super :: mystd:: str:: FromStr ;
8- use super :: { OsString , Vec } ;
8+ use super :: { OsString , String , Vec } ;
99
1010#[ derive( PartialEq , Eq , Debug ) ]
1111pub ( super ) struct MapsEntry {
@@ -55,11 +55,11 @@ pub(super) struct MapsEntry {
5555
5656pub ( super ) fn parse_maps ( ) -> Result < Vec < MapsEntry > , & ' static str > {
5757 let mut v = Vec :: new ( ) ;
58- let proc_self_maps =
58+ let mut proc_self_maps =
5959 File :: open ( "/proc/self/maps" ) . map_err ( |_| "Couldn't open /proc/self/maps" ) ?;
60- let proc_self_maps = BufReader :: new ( proc_self_maps ) ;
61- for line in proc_self_maps. lines ( ) {
62- let line = line . map_err ( |_io_error| "Couldn't read line from /proc/self/maps" ) ? ;
60+ let mut buf = String :: new ( ) ;
61+ let _bytes_read = proc_self_maps. read_to_string ( & mut buf ) . map_err ( |_| "Couldn't read /proc/self/maps" ) ? ;
62+ for line in buf . lines ( ) {
6363 v. push ( line. parse ( ) ?) ;
6464 }
6565
You can’t perform that action at this time.
0 commit comments