File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1180,23 +1180,35 @@ static int compare_driver_directory( const void* data, const void* user_data )
11801180 return 0 ;
11811181 }
11821182
1183- char directory_path [MAX_PATH_LENGTH ] = {0 };
1184- if (read_driver_parent_directory (node , directory_path , sizeof (directory_path )) != 0 )
1183+ char parent_dir [MAX_PATH_LENGTH ] = {0 };
1184+ if (read_driver_parent_directory (node , parent_dir , sizeof (parent_dir )) != 0 )
11851185 {
11861186 return -1 ;
11871187 }
11881188
1189- char * driver_path = directory_path ;
1190- while (* path )
1189+ // Compare paths, handling optional trailing slashes
1190+ // Get lengths
1191+ size_t path_len = strlen (path );
1192+ size_t parent_len = strlen (parent_dir );
1193+
1194+ // Remove trailing slashes from both paths for comparison
1195+ while (path_len > 1 && path [path_len - 1 ] == '/' )
11911196 {
1192- if (* path != * driver_path )
1193- {
1194- return 1 ;
1195- }
1196- path ++ ;
1197- driver_path ++ ;
1197+ path_len -- ;
11981198 }
1199- return 0 ;
1199+ while (parent_len > 1 && parent_dir [parent_len - 1 ] == '/' )
1200+ {
1201+ parent_len -- ;
1202+ }
1203+
1204+ // Lengths must match
1205+ if (path_len != parent_len )
1206+ {
1207+ return 1 ;
1208+ }
1209+
1210+ // Content must match
1211+ return strncmp (path , parent_dir , path_len );
12001212}
12011213
12021214/**
You can’t perform that action at this time.
0 commit comments