summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2019-12-10 20:42:59 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2019-12-10 20:42:59 +0100
commit79f10a249708792dbb27087495c3a466f2bf8dbe (patch)
tree4650364fee9d050783be12c44076b2d12c44392e
parent6f24cf45f6f93f52b6bbb3ddb63118dd4a3d93cd (diff)
PhotoRec: Ctrl-C should break from more locations (see 6f24cf45f6f93f52b6bbb3ddb63118dd4a3d93cd)
-rw-r--r--src/Makefile.am8
-rw-r--r--src/phcli.c3
-rw-r--r--src/ppartseln.c3
3 files changed, 9 insertions, 5 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 7151f24..2793e0f 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -363,12 +363,12 @@ file_C = filegen.c \
file_H = ext2.h ext2_common.h filegen.h file_doc.h file_jpg.h file_gz.h file_sp3.h file_tar.h file_tiff.h file_txt.h ole.h pe.h suspend.h
-photorec_C = photorec.c phcfg.c addpart.c chgarch.c dir.c exfatp.c ext2grp.c ext2_dir.c ext2p.c fat_dir.c fatp.c file_found.c geometry.c ntfs_dir.c ntfsp.c pdisksel.c phcli.c poptions.c sessionp.c setdate.c dfxml.c
+photorec_C = photorec.c phcfg.c addpart.c chgarch.c dir.c exfatp.c ext2grp.c ext2_dir.c ext2p.c fat_dir.c fatp.c file_found.c geometry.c ntfs_dir.c ntfsp.c pdisksel.c poptions.c sessionp.c setdate.c dfxml.c
-photorec_H = photorec.h phcfg.h addpart.h chgarch.h dir.h exfatp.h ext2grp.h ext2p.h ext2_dir.h ext2_inc.h fat_dir.h fatp.h file_found.h geometry.h memmem.h ntfs_dir.h ntfsp.h ntfs_inc.h pdisksel.h phcli.h poptions.h sessionp.h setdate.h dfxml.h
+photorec_H = photorec.h phcfg.h addpart.h chgarch.h dir.h exfatp.h ext2grp.h ext2p.h ext2_dir.h ext2_inc.h fat_dir.h fatp.h file_found.h geometry.h memmem.h ntfs_dir.h ntfsp.h ntfs_inc.h pdisksel.h poptions.h sessionp.h setdate.h dfxml.h
-photorec_ncurses_C = addpartn.c askloc.c chgarchn.c chgtype.c chgtypen.c fat_cluster.c fat_unformat.c geometryn.c hiddenn.c intrfn.c nodisk.c parti386n.c partgptn.c partmacn.c partsunn.c partxboxn.c pbanner.c pblocksize.c pdiskseln.c pfree_whole.c phbf.c phbs.c phnc.c phrecn.c ppartseln.c psearchn.c
-photorec_ncurses_H = addpartn.h askloc.h chgarchn.h chgtype.h chgtypen.h fat_cluster.h fat_unformat.h geometryn.h hiddenn.h intrfn.h nodisk.h parti386n.h partgptn.h partmacn.h partsunn.h partxboxn.h pblocksize.h pdiskseln.h pfree_whole.h pnext.h phbf.h phbs.h phnc.h phrecn.h ppartseln.h psearch.h psearchn.h photorec_check_header.h
+photorec_ncurses_C = addpartn.c askloc.c chgarchn.c chgtype.c chgtypen.c fat_cluster.c fat_unformat.c geometryn.c hiddenn.c intrfn.c nodisk.c parti386n.c partgptn.c partmacn.c partsunn.c partxboxn.c pbanner.c pblocksize.c pdiskseln.c pfree_whole.c phbf.c phbs.c phcli.c phnc.c phrecn.c ppartseln.c psearchn.c
+photorec_ncurses_H = addpartn.h askloc.h chgarchn.h chgtype.h chgtypen.h fat_cluster.h fat_unformat.h geometryn.h hiddenn.h intrfn.h nodisk.h parti386n.h partgptn.h partmacn.h partsunn.h partxboxn.h pblocksize.h pdiskseln.h pfree_whole.h pnext.h phbf.h phbs.h phcli.h phnc.h phrecn.h ppartseln.h psearch.h psearchn.h photorec_check_header.h
QT_TS = \
lang/qphotorec.ca.ts \
diff --git a/src/phcli.c b/src/phcli.c
index c08c05c..952d13d 100644
--- a/src/phcli.c
+++ b/src/phcli.c
@@ -41,6 +41,7 @@
#include "poptions.h"
#include "phcli.h"
+extern int need_to_stop;
typedef enum { INIT_SPACE_WHOLE, INIT_SPACE_PREINIT, INIT_SPACE_EXT2_GROUP, INIT_SPACE_EXT2_INODE } init_mode_t;
static int spacerange_cmp(const struct td_list_head *a, const struct td_list_head *b)
@@ -136,6 +137,8 @@ int menu_photorec_cli(list_part_t *list_part, struct ph_param *params, struct ph
skip_comma_in_command(&params->cmd_run);
if(params->cmd_run[0]=='\0')
return 0;
+ if(need_to_stop!=0)
+ return 0;
if(check_command(&params->cmd_run,"search",6)==0)
{
if(mode_init_space==INIT_SPACE_EXT2_GROUP)
diff --git a/src/ppartseln.c b/src/ppartseln.c
index da3dced..2213d65 100644
--- a/src/ppartseln.c
+++ b/src/ppartseln.c
@@ -54,6 +54,7 @@
#include "addpartn.h"
#include "intrfn.h"
+extern int need_to_stop;
extern const arch_fnct_t arch_none;
#ifdef HAVE_NCURSES
@@ -137,7 +138,7 @@ void menu_photorec(struct ph_param *params, struct ph_options *options, alloc_da
current_element_num=0;
current_element=list_part;
}
- while(done==0)
+ while(done==0 && need_to_stop==0)
{ /* ncurses interface */
list_part_t *element;
unsigned int i;