diff options
Diffstat (limited to 'openocd-0.9.0-exit-clean.patch')
-rw-r--r-- | openocd-0.9.0-exit-clean.patch | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/openocd-0.9.0-exit-clean.patch b/openocd-0.9.0-exit-clean.patch new file mode 100644 index 000000000000..4babc355a651 --- /dev/null +++ b/openocd-0.9.0-exit-clean.patch @@ -0,0 +1,59 @@ +diff --git a/src/helper/command.c b/src/helper/command.c +index c29f113..d01c35e 100644 +--- a/src/helper/command.c ++++ b/src/helper/command.c +@@ -118,10 +118,17 @@ static void command_log_capture_finish(struct log_capture_state *state) + static int command_retval_set(Jim_Interp *interp, int retval) + { + int *return_retval = Jim_GetAssocData(interp, "retval"); +- if (return_retval != NULL) +- *return_retval = retval; + +- return (retval == ERROR_OK) ? JIM_OK : JIM_ERR; ++ if (retval == ERROR_COMMAND_CLOSE_CONNECTION) ++ { ++ if (return_retval != NULL) ++ *return_retval = 0; ++ return JIM_EXIT; ++ } else { ++ if (return_retval != NULL) ++ *return_retval = retval; ++ return (retval == ERROR_OK) ? JIM_OK : JIM_ERR; ++ } + } + + extern struct command_context *global_cmd_ctx; +@@ -671,8 +678,7 @@ int command_run_line(struct command_context *context, char *line) + } + return retval; + } else if (retcode == JIM_EXIT) { +- /* ignore. +- * exit(Jim_GetExitCode(interp)); */ ++ return ERROR_OK_EXIT; + } else { + const char *result; + int reslen; +diff --git a/src/helper/log.h b/src/helper/log.h +index 7f9f32c..8a15b41 100644 +--- a/src/helper/log.h ++++ b/src/helper/log.h +@@ -140,5 +140,6 @@ extern int debug_level; + #define ERROR_FAIL (-4) + #define ERROR_WAIT (-5) + ++#define ERROR_OK_EXIT (-6) + + #endif /* LOG_H */ +diff --git a/src/openocd.c b/src/openocd.c +index b0dd21a..847c137 100644 +--- a/src/openocd.c ++++ b/src/openocd.c +@@ -283,6 +283,8 @@ static int openocd_thread(int argc, char *argv[], struct command_context *cmd_ct + return ERROR_FAIL; + + ret = parse_config_file(cmd_ctx); ++ if (ret == ERROR_OK_EXIT) ++ return ERROR_OK; + if (ret != ERROR_OK) + return ERROR_FAIL; + |