summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristophe Grenier <grenier@cgsecurity.org>2020-08-08 12:00:30 +0200
committerChristophe Grenier <grenier@cgsecurity.org>2020-08-08 12:00:30 +0200
commitc7fe668efa5905091d3704083383c85ee5e2811c (patch)
tree963c089addcfc84710cff8e5b9cd4183903d4e7c
parent7fcac38ea35e013ce975400e6927799dde3505ba (diff)
Make the return value explicit in photorec_aux() when the user presses
STOP (Code readability)
-rw-r--r--configure.ac2
-rw-r--r--src/phnc.h6
-rw-r--r--src/psearchn.c6
3 files changed, 9 insertions, 5 deletions
diff --git a/configure.ac b/configure.ac
index 7769464..c3ebb5b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -6,7 +6,7 @@ AC_INIT([testdisk],[7.2-WIP],[grenier@cgsecurity.org])
AC_LANG(C)
sinclude(acx_pthread.m4)
sinclude(mkdir.m4)
-TESTDISKDATE="May 2020"
+TESTDISKDATE="August 2020"
AC_SUBST(TESTDISKDATE)
AC_DEFINE_UNQUOTED([TESTDISKDATE],"$TESTDISKDATE",[Date of release])
AC_CONFIG_AUX_DIR(config)
diff --git a/src/phnc.h b/src/phnc.h
index 42fdd53..3a1bf20 100644
--- a/src/phnc.h
+++ b/src/phnc.h
@@ -24,6 +24,12 @@ extern "C" {
#endif
#ifdef HAVE_NCURSES
void photorec_info(WINDOW *window, const file_stat_t *file_stats);
+
+/*@
+ @ requires \valid(window);
+ @ requires \valid_read(params);
+ @ ensures \result == PSTATUS_OK || \result == PSTATUS_STOP;
+ @*/
pstatus_t photorec_progressbar(WINDOW *window, const unsigned int pass, const struct ph_param *params, const uint64_t offset, const time_t current_time);
#endif
#ifdef __cplusplus
diff --git a/src/psearchn.c b/src/psearchn.c
index 284ee66..80cb622 100644
--- a/src/psearchn.c
+++ b/src/psearchn.c
@@ -302,15 +302,13 @@ pstatus_t photorec_aux(struct ph_param *params, const struct ph_options *options
#ifdef HAVE_NCURSES
ind_stop=photorec_progressbar(stdscr, params->pass, params, offset, current_time);
#endif
- if(need_to_stop!=0)
- ind_stop=PSTATUS_STOP;
params->offset=offset;
- if(ind_stop!=PSTATUS_OK)
+ if(need_to_stop!=0 || ind_stop!=PSTATUS_OK)
{
log_info("PhotoRec has been stopped\n");
file_recovery_aborted(&file_recovery, params, list_search_space);
free(buffer_start);
- return ind_stop;
+ return PSTATUS_STOP;
}
if(current_time >= next_checkpoint)
next_checkpoint=regular_session_save(list_search_space, params, options, current_time);