summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/dir.c5
-rw-r--r--src/dir.h2
-rw-r--r--src/ntfs_fix.c16
3 files changed, 10 insertions, 13 deletions
diff --git a/src/dir.c b/src/dir.c
index a1cb33f..f821d0d 100644
--- a/src/dir.c
+++ b/src/dir.c
@@ -550,15 +550,18 @@ static long int dir_aff_ncurses(disk_t *disk, const partition_t *partition, dir_
}
#endif
-void delete_list_file(file_data_t *file_list)
+unsigned int delete_list_file(file_data_t *file_list)
{
+ int nbr=0;
file_data_t *current_file=file_list;
while(current_file!=NULL)
{
file_data_t *next=current_file->next;
free(current_file);
current_file=next;
+ nbr++;
}
+ return nbr;
}
void delete_list_file_info(struct td_list_head *list)
diff --git a/src/dir.h b/src/dir.h
index 52bd583..a21764b 100644
--- a/src/dir.h
+++ b/src/dir.h
@@ -73,7 +73,7 @@ typedef struct
int dir_aff_log(const disk_t *disk_car, const partition_t *partition, const dir_data_t *dir_data, const file_data_t*dir_list);
int log_list_file(const disk_t *disk_car, const partition_t *partition, const dir_data_t *dir_data, const file_info_t*list);
-void delete_list_file(file_data_t *file_list);
+unsigned int delete_list_file(file_data_t *file_list);
void delete_list_file_info(struct td_list_head *list);
int dir_partition_aff(disk_t *disk_car, const partition_t *partition, dir_data_t *dir_data, const unsigned long int inode, char **current_cmd);
int dir_whole_partition_log(disk_t *disk_car, const partition_t *partition, dir_data_t *dir_data, const unsigned long int inode);
diff --git a/src/ntfs_fix.c b/src/ntfs_fix.c
index d322b0a..a049089 100644
--- a/src/ntfs_fix.c
+++ b/src/ntfs_fix.c
@@ -56,7 +56,6 @@ int repair_MFT(disk_t *disk_car, partition_t *partition, const int verbose, cons
unsigned char *buffer_mftmirr;
unsigned int cluster_size;
unsigned int mft_record_size;
- unsigned int mftmirr_size;
unsigned int mftmirr_size_bytes;
unsigned int use_MFT=0;
/* 0: do nothing
@@ -86,15 +85,10 @@ int repair_MFT(disk_t *disk_car, partition_t *partition, const int verbose, cons
cluster_size=ntfs_header->sectors_per_cluster;
- if (cluster_size <= 4 * mft_record_size)
- mftmirr_size = 4;
- else
- mftmirr_size = cluster_size / mft_record_size;
- mftmirr_size_bytes=mftmirr_size * mft_record_size * ntfs_sector_size(ntfs_header);
+ mftmirr_size_bytes = (cluster_size <= 4 * mft_record_size ? 4 * mft_record_size : cluster_size) * ntfs_sector_size(ntfs_header);
#ifdef DEBUG_REPAIR_MFT
log_debug("mft_pos %lu\n",(unsigned long)(mft_pos/disk_car->sector_size));
log_debug("mftmirr_pos %lu\n",(unsigned long)(mftmirr_pos/disk_car->sector_size));
- log_debug("mftmirr_size %u\n", mftmirr_size);
log_debug("cluster_size %u\n", cluster_size);
log_debug("mft_record_size %u\n", mft_record_size);
log_debug("ntfs_sector_size %u\n", ntfs_sector_size(ntfs_header));
@@ -181,8 +175,8 @@ int repair_MFT(disk_t *disk_car, partition_t *partition, const int verbose, cons
{
log_info("NTFS listing using MFT:\n");
dir_aff_log(disk_car, partition, &dir_data, dir_list);
- delete_list_file(dir_list);
- res1++;
+ if(delete_list_file(dir_list)>2)
+ res1++;
}
dir_data.close(&dir_data);
}
@@ -198,8 +192,8 @@ int repair_MFT(disk_t *disk_car, partition_t *partition, const int verbose, cons
{
log_info("NTFS listing using MFT mirror:\n");
dir_aff_log(disk_car, partition, &dir_data, dir_list);
- delete_list_file(dir_list);
- res2++;
+ if(delete_list_file(dir_list)>2)
+ res2++;
}
dir_data.close(&dir_data);
}