@@ -968,34 +968,34 @@ static int read_directory_recursive(struct dir_struct *dir,
968
968
{
969
969
DIR * fdir = opendir (* base ? base : "." );
970
970
int contents = 0 ;
971
+ struct dirent * de ;
972
+ char path [PATH_MAX + 1 ];
971
973
972
- if (fdir ) {
973
- struct dirent * de ;
974
- char path [PATH_MAX + 1 ];
975
- memcpy (path , base , baselen );
976
-
977
- while ((de = readdir (fdir )) != NULL ) {
978
- int len ;
979
- switch (treat_path (dir , de , path , sizeof (path ),
980
- baselen , simplify , & len )) {
981
- case path_recurse :
982
- contents += read_directory_recursive
983
- (dir , path , len , 0 , simplify );
984
- continue ;
985
- case path_ignored :
986
- continue ;
987
- case path_handled :
988
- break ;
989
- }
990
- contents ++ ;
991
- if (check_only )
992
- goto exit_early ;
993
- else
994
- dir_add_name (dir , path , len );
974
+ if (!fdir )
975
+ return 0 ;
976
+
977
+ memcpy (path , base , baselen );
978
+
979
+ while ((de = readdir (fdir )) != NULL ) {
980
+ int len ;
981
+ switch (treat_path (dir , de , path , sizeof (path ),
982
+ baselen , simplify , & len )) {
983
+ case path_recurse :
984
+ contents += read_directory_recursive (dir , path , len , 0 , simplify );
985
+ continue ;
986
+ case path_ignored :
987
+ continue ;
988
+ case path_handled :
989
+ break ;
995
990
}
996
- exit_early :
997
- closedir (fdir );
991
+ contents ++ ;
992
+ if (check_only )
993
+ goto exit_early ;
994
+ else
995
+ dir_add_name (dir , path , len );
998
996
}
997
+ exit_early :
998
+ closedir (fdir );
999
999
1000
1000
return contents ;
1001
1001
}
0 commit comments