Update dircomp.c

This commit is contained in:
Alessandro Ferro 2023-04-29 21:47:41 +02:00
parent 28f5b6db95
commit 53ca658503
1 changed files with 6 additions and 4 deletions

View File

@ -102,10 +102,6 @@ bool analyze_directories(char* directory_to_analyze_1, char* directory_to_analyz
struct dirent *element; struct dirent *element;
DIR *directory1, *directory2; DIR *directory1, *directory2;
if(strcmp(directory_to_analyze_1, directory_to_analyze_2) == 0){
return true;
}
directory1 = opendir(directory_to_analyze_1); directory1 = opendir(directory_to_analyze_1);
directory2 = opendir(directory_to_analyze_2); directory2 = opendir(directory_to_analyze_2);
@ -118,6 +114,12 @@ bool analyze_directories(char* directory_to_analyze_1, char* directory_to_analyz
return false; return false;
} }
if(strcmp(directory_to_analyze_1, directory_to_analyze_2) == 0){
free(directory_to_analyze_1);
free(directory_to_analyze_2);
return true;
}
while ((element = readdir(directory1)) != NULL) while ((element = readdir(directory1)) != NULL)
{ {
// Is file // Is file