summaryrefslogtreecommitdiffstats
path: root/src/file_r3d.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2015-06-12 19:49:50 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2015-06-12 19:49:50 +0200
commit04d653114489586908a37b6f405340fdcb9a3824 (patch)
tree6ecd19bcbadcfdb1b575402ff5856991f80cbbee /src/file_r3d.c
parent56e27e660059e73f1315f83c660fc358c02e41d7 (diff)
PhotoRec: log the correct filename if file has been renamed
Diffstat (limited to 'src/file_r3d.c')
-rw-r--r--src/file_r3d.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/file_r3d.c b/src/file_r3d.c
index 8477c0e..5052829 100644
--- a/src/file_r3d.c
+++ b/src/file_r3d.c
@@ -35,7 +35,7 @@
static void register_header_check_r3d(file_stat_t *file_stat);
static int header_check_r3d(const unsigned char *buffer, const unsigned int buffer_size, const unsigned int safe_header_only, const file_recovery_t *file_recovery, file_recovery_t *file_recovery_new);
-static void file_rename_r3d(const char *old_filename);
+static void file_rename_r3d(file_recovery_t *file_recovery);
const file_hint_t file_hint_r3d= {
.extension="r3d",
@@ -125,24 +125,24 @@ static int header_check_r3d_v2(const unsigned char *buffer, const unsigned int b
return 0;
}
-static void file_rename_r3d(const char *old_filename)
+static void file_rename_r3d(file_recovery_t *file_recovery)
{
unsigned char buffer[512];
FILE *file;
size_t buffer_size;
unsigned int i;
- if((file=fopen(old_filename, "rb"))==NULL)
+ if((file=fopen(file_recovery->filename, "rb"))==NULL)
return;
buffer_size=fread(buffer, 1, sizeof(buffer), file);
fclose(file);
- if(buffer_size<10)
+ if(buffer_size<0x44)
return;
for(i=0x43; i< buffer_size && buffer[i]!=0 && buffer[i]!='.'; i++)
{
if(!isalnum(buffer[i]) && buffer[i]!='_')
return ;
}
- file_rename(old_filename, buffer, i, 0x43, NULL, 1);
+ file_rename(file_recovery, buffer, i, 0x43, NULL, 1);
}
static void register_header_check_r3d(file_stat_t *file_stat)