From 8973f2beca32b45d5b34dba7102c31677e667e0e Mon Sep 17 00:00:00 2001 From: Jens Steube Date: Mon, 12 Sep 2022 20:48:38 +0200 Subject: [PATCH] Add more RC_FINAL_ enum types --- docs/status_codes.txt | 1 + include/types.h | 9 +++++++-- src/hashcat.c | 12 ++++++------ 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/docs/status_codes.txt b/docs/status_codes.txt index b40ac93d0..af5a2318d 100644 --- a/docs/status_codes.txt +++ b/docs/status_codes.txt @@ -17,3 +17,4 @@ status codes on exit: 2 = aborted 3 = aborted by checkpoint 4 = aborted by runtime + 5 = aborted by finish diff --git a/include/types.h b/include/types.h index ce04d81ad..864e53a10 100644 --- a/include/types.h +++ b/include/types.h @@ -226,8 +226,13 @@ typedef enum status_rc typedef enum rc_final { - RC_FINAL_OK = 0, - RC_FINAL_EXHAUSTED = 1 + RC_FINAL_ERROR = -1, + RC_FINAL_OK = 0, + RC_FINAL_EXHAUSTED = 1, + RC_FINAL_ABORT = 2, + RC_FINAL_ABORT_CHECKPOINT = 3, + RC_FINAL_ABORT_RUNTIME = 4, + RC_FINAL_ABORT_FINISH = 5, } rc_final_t; diff --git a/src/hashcat.c b/src/hashcat.c index 517fb5465..693a3b906 100644 --- a/src/hashcat.c +++ b/src/hashcat.c @@ -1807,14 +1807,14 @@ int hashcat_session_execute (hashcat_ctx_t *hashcat_ctx) if (rc_final == 0) { - if (status_ctx->devices_status == STATUS_ABORTED_FINISH) rc_final = 5; - if (status_ctx->devices_status == STATUS_ABORTED_RUNTIME) rc_final = 4; - if (status_ctx->devices_status == STATUS_ABORTED_CHECKPOINT) rc_final = 3; - if (status_ctx->devices_status == STATUS_ABORTED) rc_final = 2; - if (status_ctx->devices_status == STATUS_QUIT) rc_final = 2; + if (status_ctx->devices_status == STATUS_ABORTED_FINISH) rc_final = RC_FINAL_ABORT_FINISH; + if (status_ctx->devices_status == STATUS_ABORTED_RUNTIME) rc_final = RC_FINAL_ABORT_RUNTIME; + if (status_ctx->devices_status == STATUS_ABORTED_CHECKPOINT) rc_final = RC_FINAL_ABORT_CHECKPOINT; + if (status_ctx->devices_status == STATUS_ABORTED) rc_final = RC_FINAL_ABORT; + if (status_ctx->devices_status == STATUS_QUIT) rc_final = RC_FINAL_ABORT; if (status_ctx->devices_status == STATUS_EXHAUSTED) rc_final = RC_FINAL_EXHAUSTED; if (status_ctx->devices_status == STATUS_CRACKED) rc_final = RC_FINAL_OK; - if (status_ctx->devices_status == STATUS_ERROR) rc_final = -1; + if (status_ctx->devices_status == STATUS_ERROR) rc_final = RC_FINAL_ERROR; } else if (rc_final == -1) {