File tree Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Expand file tree Collapse file tree 1 file changed +3
-12
lines changed Original file line number Diff line number Diff line change 22// in `mod libs_dl_iterate_phdr` (e.g. linux, freebsd, ...); it may be more
33// general purpose, but it hasn't been tested elsewhere.
44
5- use super :: mystd:: fs:: File ;
5+ use super :: mystd:: fs:: { self , File } ;
66use super :: mystd:: io:: Read ;
77use super :: mystd:: str:: FromStr ;
88use super :: { OsString , String , Vec } ;
@@ -54,18 +54,9 @@ pub(super) struct MapsEntry {
5454}
5555
5656pub ( super ) fn parse_maps ( ) -> Result < Vec < MapsEntry > , & ' static str > {
57- let mut v = Vec :: new ( ) ;
58- let mut proc_self_maps =
59- File :: open ( "/proc/self/maps" ) . map_err ( |_| "Couldn't open /proc/self/maps" ) ?;
60- let mut buf = String :: new ( ) ;
61- let _bytes_read = proc_self_maps
62- . read_to_string ( & mut buf)
63- . map_err ( |_| "Couldn't read /proc/self/maps" ) ?;
64- for line in buf. lines ( ) {
65- v. push ( line. parse ( ) ?) ;
66- }
57+ let buf = fs:: read_to_string ( "/proc/self/maps" ) . map_err ( |_| "" ) ?;
6758
68- Ok ( v )
59+ buf . lines ( ) . map ( |line| line . parse ( ) ) . collect ( )
6960}
7061
7162impl MapsEntry {
You can’t perform that action at this time.
0 commit comments