From 8b12fd3d04bd4d4914fee6530d770c9171ea4bc4 Mon Sep 17 00:00:00 2001 From: Christophe Grenier Date: Sat, 11 Feb 2012 19:25:53 +0100 Subject: [PATCH] PhotoRec: avoid successive '_' chars in filenames --- src/filegen.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/filegen.c b/src/filegen.c index 2f21c153..a1eef806 100644 --- a/src/filegen.c +++ b/src/filegen.c @@ -401,7 +401,8 @@ void file_rename(const char *old_filename, const unsigned char *buffer, const in case '\\': case ':': case '*': - *dst++ = '_'; + if(*(dst-1) != '_') + *dst++ = '_'; bad++; break; default: @@ -412,7 +413,8 @@ void file_rename(const char *old_filename, const unsigned char *buffer, const in } else { - *dst++ = '_'; + if(*(dst-1) != '_') + *dst++ = '_'; bad++; } break;