server/server: Remove all exit() calls

With this patch OpenOCD shuts down properly when errors occur in the
server instead of just calling exit().

Change-Id: I2ae1a6153dafc88667951cab9152941cb487be85
Signed-off-by: Marc Schink <openocd-dev@marcschink.de>
Reviewed-on: http://openocd.zylin.com/3223
Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
Tested-by: jenkins
This commit is contained in:
Marc Schink
2016-01-24 20:58:24 +01:00
committed by Freddie Chopin
parent 99db18a995
commit b43b95e460
3 changed files with 52 additions and 23 deletions

View File

@@ -297,8 +297,10 @@ static int openocd_thread(int argc, char *argv[], struct command_context *cmd_ct
if (init_at_startup) {
ret = command_run_line(cmd_ctx, "init");
if (ERROR_OK != ret)
if (ERROR_OK != ret) {
server_quit();
return ERROR_FAIL;
}
}
ret = server_loop(cmd_ctx);