summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2017-09-28 21:24:48 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2017-09-28 21:24:48 +0200
commit07237aae0e2be0ae0c799cb0ea9aebd127e560b5 (patch)
tree72535021bfa95cdef2e565c087e616d3f5a09361 /src
parentead22c45f1778db11bda68dabdaac689a6fb11f9 (diff)
fidentify: if checks are enabled, run them before displaying the file type.
Diffstat (limited to 'src')
-rw-r--r--src/fidentify.c28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/fidentify.c b/src/fidentify.c
index b9202f1..2437072 100644
--- a/src/fidentify.c
+++ b/src/fidentify.c
@@ -108,24 +108,30 @@ static int file_identify(const char *filename, const unsigned int check)
if(file_recovery_new.file_stat!=NULL)
break;
}
+ if(file_recovery_new.file_stat!=NULL && file_recovery_new.file_stat->file_hint!=NULL &&
+ check > 0 && file_recovery_new.file_check!=NULL)
+ {
+ file_recovery_new.handle=file;
+ my_fseek(file_recovery_new.handle, 0, SEEK_END);
+#ifdef HAVE_FTELLO
+ file_recovery_new.file_size=ftello(file_recovery_new.handle);
+#else
+ file_recovery_new.file_size=ftell(file_recovery_new.handle);
+#endif
+ file_recovery_new.calculated_file_size=file_recovery_new.file_size;
+ (file_recovery_new.file_check)(&file_recovery_new);
+ if(file_recovery_new.file_size < file_recovery_new.min_filesize)
+ file_recovery_new.file_size=0;
+ if(file_recovery_new.file_size==0)
+ file_recovery_new.file_stat=NULL;
+ }
if(file_recovery_new.file_stat!=NULL && file_recovery_new.file_stat->file_hint!=NULL)
{
printf("%s: %s", filename,
((file_recovery_new.extension!=NULL && file_recovery_new.extension[0]!='\0')?
file_recovery_new.extension:file_recovery_new.file_stat->file_hint->description));
if(check > 0 && file_recovery_new.file_check!=NULL)
- {
- file_recovery_new.handle=file;
- my_fseek(file_recovery_new.handle, 0, SEEK_END);
-#ifdef HAVE_FTELLO
- file_recovery_new.file_size=ftello(file_recovery_new.handle);
-#else
- file_recovery_new.file_size=ftell(file_recovery_new.handle);
-#endif
- file_recovery_new.calculated_file_size=file_recovery_new.file_size;
- (file_recovery_new.file_check)(&file_recovery_new);
printf(" file_size=%llu", (long long unsigned)file_recovery_new.file_size);
- }
printf("\n");
}
else