From 30d8427d31f2bbbdc22fd62cc5da287e728e3819 Mon Sep 17 00:00:00 2001 From: Christophe Grenier Date: Thu, 23 Dec 2010 22:11:04 +0100 Subject: [PATCH] PhotoRec: fix the order of file checks --- src/filegen.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/filegen.c b/src/filegen.c index 8557e715..5a61fd63 100644 --- a/src/filegen.c +++ b/src/filegen.c @@ -58,7 +58,10 @@ static int file_check_cmp(const struct td_list_head *a, const struct td_list_hea res=fc_a->offset-fc_b->offset; if(res!=0) return res; - return memcmp(fc_a->value,fc_b->value, (fc_a->length<=fc_b->length?fc_a->length:fc_b->length)); + res=memcmp(fc_a->value,fc_b->value, (fc_a->length<=fc_b->length?fc_a->length:fc_b->length)); + if(res!=0) + return res; + return fc_b->length-fc_a->length; } static void file_check_add_tail(file_check_t *file_check_new, file_check_list_t *pos)