File tree 1 file changed +3
-12
lines changed
1 file changed +3
-12
lines changed Original file line number Diff line number Diff line change 2
2
// in `mod libs_dl_iterate_phdr` (e.g. linux, freebsd, ...); it may be more
3
3
// general purpose, but it hasn't been tested elsewhere.
4
4
5
- use super :: mystd:: fs:: File ;
5
+ use super :: mystd:: fs:: { self , File } ;
6
6
use super :: mystd:: io:: Read ;
7
7
use super :: mystd:: str:: FromStr ;
8
8
use super :: { OsString , String , Vec } ;
@@ -54,18 +54,9 @@ pub(super) struct MapsEntry {
54
54
}
55
55
56
56
pub ( 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 ( |_| "" ) ?;
67
58
68
- Ok ( v )
59
+ buf . lines ( ) . map ( |line| line . parse ( ) ) . collect ( )
69
60
}
70
61
71
62
impl MapsEntry {
You can’t perform that action at this time.
0 commit comments