File tree Expand file tree Collapse file tree 2 files changed +13
-4
lines changed
Expand file tree Collapse file tree 2 files changed +13
-4
lines changed Original file line number Diff line number Diff line change @@ -133,11 +133,16 @@ impl Bpf {
133133 let mut new_paths = Vec :: with_capacity ( paths_config. len ( ) ) ;
134134 let mut builder = GlobSetBuilder :: new ( ) ;
135135 for p in paths_config. iter ( ) {
136+ let Some ( glob_str) = p. to_str ( ) else {
137+ bail ! ( "failed to convert path {} to string" , p. display( ) ) ;
138+ } ;
139+
136140 builder. add (
137- Glob :: new ( & p . to_string_lossy ( ) )
138- . with_context ( || format ! ( "invalid glob {}" , p . display ( ) ) )
141+ Glob :: new ( glob_str )
142+ . with_context ( || format ! ( "invalid glob {}" , glob_str ) )
139143 . unwrap ( ) ,
140144 ) ;
145+
141146 let prefix = path_prefix_t:: try_from ( p) ?;
142147 path_prefix. insert ( & prefix. into ( ) , 0 , 0 ) ?;
143148 new_paths. push ( prefix) ;
Original file line number Diff line number Diff line change @@ -25,7 +25,7 @@ use std::{
2525 sync:: Arc ,
2626} ;
2727
28- use anyhow:: Context ;
28+ use anyhow:: { Context , bail } ;
2929use aya:: maps:: MapData ;
3030use fact_ebpf:: { inode_key_t, inode_value_t} ;
3131use log:: { debug, info, warn} ;
@@ -85,7 +85,11 @@ impl HostScanner {
8585 }
8686
8787 fn scan_inner ( & self , path : & Path ) -> anyhow:: Result < ( ) > {
88- for entry in glob:: glob ( & path. to_string_lossy ( ) ) ? {
88+ let Some ( glob_str) = path. to_str ( ) else {
89+ bail ! ( "invalid path {}" , path. display( ) ) ;
90+ } ;
91+
92+ for entry in glob:: glob ( glob_str) ? {
8993 match entry {
9094 Ok ( path) => {
9195 if path. is_file ( ) {
You can’t perform that action at this time.
0 commit comments