From 9b879b0dc0eb4216b0c20aa861ded7e0929134fc Mon Sep 17 00:00:00 2001 From: douniwan5788 Date: Thu, 5 Sep 2024 19:31:37 +0800 Subject: [PATCH] fix: exit status --- client/src/cmdmain.c | 2 +- client/src/proxmark3.c | 7 ++++++- include/pm3_cmd.h | 3 ++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/client/src/cmdmain.c b/client/src/cmdmain.c index 35dcfc39b..b738fe620 100644 --- a/client/src/cmdmain.c +++ b/client/src/cmdmain.c @@ -283,7 +283,7 @@ static int CmdQuit(const char *Cmd) { }; CLIExecWithReturn(ctx, Cmd, argtable, true); CLIParserFree(ctx); - return PM3_EFATAL; + return PM3_SQUIT; } static int CmdRev(const char *Cmd) { diff --git a/client/src/proxmark3.c b/client/src/proxmark3.c index f5da41dc7..f098eaf6c 100644 --- a/client/src/proxmark3.c +++ b/client/src/proxmark3.c @@ -44,7 +44,7 @@ #endif -static int mainret = PM3_ESOFT; +static int mainret = PM3_SUCCESS; #ifndef LIBPM3 #define BANNERMSG1 "" @@ -574,6 +574,11 @@ check_script: // exit or quit if (mainret == PM3_EFATAL) break; + if (mainret == PM3_SQUIT) { + // Normal quit, map to 0 + mainret = PM3_SUCCESS; + break; + } } free(cmd); cmd = NULL; diff --git a/include/pm3_cmd.h b/include/pm3_cmd.h index 9ccbbeb5c..a8c5988f9 100644 --- a/include/pm3_cmd.h +++ b/include/pm3_cmd.h @@ -863,7 +863,8 @@ typedef struct { #define PM3_ENODATA -98 // Quit program client: reserved, order to quit the program #define PM3_EFATAL -99 - +// Regular quit +#define PM3_SQUIT -100 // LF #define LF_FREQ2DIV(f) ((int)(((12000.0 + (f)/2.0)/(f))-1))