summaryrefslogtreecommitdiffstats
path: root/src/pdiskseln.c
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2019-12-10 20:57:57 +0100
committerChristophe Grenier <grenier@cgsecurity.org>2019-12-10 20:57:57 +0100
commitac95883e2216cae52285b72dbdda9d443f9894ea (patch)
treeb0c536dcd23395f3577c267fb51e126c6293f93a /src/pdiskseln.c
parent8a91bdfbfd5dc9124ad5fb1a7beda5a8ebcf5b97 (diff)
"photorec /d recup_dir /cmd resume" can be used to resume a session
automatically. If no session is available, prompt the user. See https://github.com/cgsecurity/testdisk/issues/73
Diffstat (limited to 'src/pdiskseln.c')
-rw-r--r--src/pdiskseln.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/pdiskseln.c b/src/pdiskseln.c
index c00d65a..9779c8c 100644
--- a/src/pdiskseln.c
+++ b/src/pdiskseln.c
@@ -267,14 +267,15 @@ int do_curses_photorec(struct ph_param *params, struct ph_options *options, cons
static alloc_data_t list_search_space={
.list = TD_LIST_HEAD_INIT(list_search_space.list)
};
- if(params->cmd_device==NULL)
+ const int resume_session=(params->cmd_device!=NULL && strcmp(params->cmd_device,"resume")==0);
+ if(params->cmd_device==NULL || resume_session!=0)
{
char *saved_device=NULL;
char *saved_cmd=NULL;
session_load(&saved_device, &saved_cmd,&list_search_space);
if(saved_device!=NULL && saved_cmd!=NULL && !td_list_empty(&list_search_space.list)
#ifdef HAVE_NCURSES
- && ask_confirmation("Continue previous session ? (Y/N)")!=0
+ && ( resume_session!=0 || ask_confirmation("Continue previous session ? (Y/N)")!=0)
#endif
)
{