TestDisk: consider as a potential FAT32 root directory directories with date after 2000
This commit is contained in:
parent
4763e1e5b1
commit
feecb1253f
2 changed files with 23 additions and 20 deletions
41
src/dir.c
41
src/dir.c
|
@ -155,27 +155,32 @@ void mode_string (const unsigned int mode, char *str)
|
|||
|
||||
int set_datestr(char *datestr, size_t n, const time_t timev)
|
||||
{
|
||||
int test_date=0;
|
||||
const struct tm *tm_p;
|
||||
#if defined(__MINGW32__)
|
||||
if(timev!=0 && (tm_p= localtime(&timev))!=NULL)
|
||||
#else
|
||||
#if ! defined(__MINGW32__)
|
||||
struct tm tmp;
|
||||
if(timev!=0 && (tm_p= localtime_r(&timev, &tmp))!=NULL)
|
||||
#endif
|
||||
if(timev==0)
|
||||
{
|
||||
snprintf(datestr, n,"%2d-%s-%4d %02d:%02d",
|
||||
tm_p->tm_mday, monstr[tm_p->tm_mon],
|
||||
1900 + tm_p->tm_year, tm_p->tm_hour,
|
||||
tm_p->tm_min);
|
||||
if(1900+tm_p->tm_year>=2000 && 1900+tm_p->tm_year<=2014)
|
||||
{
|
||||
test_date=1;
|
||||
}
|
||||
} else {
|
||||
strncpy(datestr, " ", n);
|
||||
return 0;
|
||||
}
|
||||
return test_date;
|
||||
#if defined(__MINGW32__)
|
||||
tm_p=localtime(&timev);
|
||||
#else
|
||||
tm_p=localtime_r(&timev, &tmp);
|
||||
#endif
|
||||
if(tm_p==NULL)
|
||||
{
|
||||
strncpy(datestr, " ", n);
|
||||
return 0;
|
||||
}
|
||||
snprintf(datestr, n,"%2d-%s-%4d %02d:%02d",
|
||||
tm_p->tm_mday, monstr[tm_p->tm_mon],
|
||||
1900 + tm_p->tm_year, tm_p->tm_hour,
|
||||
tm_p->tm_min);
|
||||
if(1900+tm_p->tm_year>=2000)
|
||||
return 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int dir_aff_log(const dir_data_t *dir_data, const file_info_t *dir_list)
|
||||
|
@ -216,9 +221,8 @@ int dir_aff_log(const dir_data_t *dir_data, const file_info_t *dir_list)
|
|||
return test_date;
|
||||
}
|
||||
|
||||
int log_list_file(const disk_t *disk, const partition_t *partition, const dir_data_t *dir_data, const file_info_t*list)
|
||||
void log_list_file(const disk_t *disk, const partition_t *partition, const dir_data_t *dir_data, const file_info_t*list)
|
||||
{
|
||||
int test_date=0;
|
||||
struct td_list_head *tmp;
|
||||
log_partition(disk, partition);
|
||||
if(dir_data!=NULL)
|
||||
|
@ -234,7 +238,7 @@ int log_list_file(const disk_t *disk, const partition_t *partition, const dir_da
|
|||
log_info("X");
|
||||
else
|
||||
log_info(" ");
|
||||
test_date=set_datestr((char *)&datestr, sizeof(datestr), current_file->td_mtime);
|
||||
set_datestr((char *)&datestr, sizeof(datestr), current_file->td_mtime);
|
||||
mode_string(current_file->st_mode, str);
|
||||
log_info("%7lu ",(unsigned long int)current_file->st_ino);
|
||||
log_info("%s %5u %5u ",
|
||||
|
@ -242,7 +246,6 @@ int log_list_file(const disk_t *disk, const partition_t *partition, const dir_da
|
|||
log_info("%9llu", (long long unsigned int)current_file->st_size);
|
||||
log_info(" %s %s\n", datestr, current_file->name);
|
||||
}
|
||||
return test_date;
|
||||
}
|
||||
|
||||
unsigned int delete_list_file(file_info_t *file_info)
|
||||
|
|
|
@ -76,7 +76,7 @@ struct dir_data
|
|||
|
||||
int set_datestr(char *datestr, size_t n, const time_t timev);
|
||||
int dir_aff_log(const dir_data_t *dir_data, const file_info_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 log_list_file(const disk_t *disk_car, const partition_t *partition, const dir_data_t *dir_data, const file_info_t*list);
|
||||
unsigned int delete_list_file(file_info_t *list);
|
||||
int dir_whole_partition_log(disk_t *disk_car, const partition_t *partition, dir_data_t *dir_data, const unsigned long int inode);
|
||||
void dir_whole_partition_copy(disk_t *disk_car, const partition_t *partition, dir_data_t *dir_data, const unsigned long int inode);
|
||||
|
|
Loading…
Reference in a new issue