summaryrefslogtreecommitdiffstats
path: root/src/godmode.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2015-09-05 18:11:16 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2015-09-05 18:11:16 +0200
commit66af14cf690bbee42b94e6d2f09c923ec5484486 (patch)
treec32b893b1aa1a563b897c4bfa1c6b156a59503e4 /src/godmode.c
parentfaa272a9198509a9f8e33681b84437686a92b01d (diff)
Ask confirmation when user quits the list of partitions found by TestDisk - 2nd try
Revert commit b1089a10ec65e1983e7c5e3ec6a70813521cdb5a
Diffstat (limited to 'src/godmode.c')
-rw-r--r--src/godmode.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/godmode.c b/src/godmode.c
index c6e4fe1..ec82862 100644
--- a/src/godmode.c
+++ b/src/godmode.c
@@ -1310,6 +1310,17 @@ static int use_backup(disk_t *disk_car, const list_part_t *list_part, const int
return 0;
}
+static int is_structure_empty(const list_part_t *list_part)
+{
+ const list_part_t *element;
+ for(element=list_part; element!=NULL; element=element->next)
+ {
+ if(element->part->status!=STATUS_DELETED)
+ return 0;
+ }
+ return 1;
+}
+
int interface_recovery(disk_t *disk_car, const list_part_t * list_part_org, const int verbose, const int dump_ind, const int align, const int ask_part_order, const unsigned int expert, char **current_cmd)
{
int res_interface_write;
@@ -1370,7 +1381,10 @@ int interface_recovery(disk_t *disk_car, const list_part_t * list_part_org, cons
}
#endif
}
- list_part=ask_structure(disk_car,list_part,verbose,current_cmd);
+ do
+ {
+ list_part=ask_structure(disk_car,list_part,verbose,current_cmd);
+ } while(fast_mode!=0 && list_part!=NULL && is_structure_empty(list_part) && ask_confirmation("Discard the results, confirm ? (Y/N)")==0);
if(disk_car->arch->test_structure(list_part)==0)
{
int do_again=0;