X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fserver%2Fserver.c;h=8da82ec88969ba038434763008be7e1bf339804e;hp=16f751079b017ed9f7c8432b6c2f3882326d5bf7;hb=70fb53f90b4134cf10de3b504f56ec7c4a248b63;hpb=b48d1f66378fac886d5bc32d7302da48c89d8a75 diff --git a/src/server/server.c b/src/server/server.c index 16f751079b..8da82ec889 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -85,6 +85,7 @@ static int add_connection(struct service *service, struct command_context *cmd_c if (retval != ERROR_OK) { close_socket(c->fd); LOG_ERROR("attempted '%s' connection rejected", service->name); + command_done(c->cmd_ctx); free(c); return retval; } @@ -104,6 +105,7 @@ static int add_connection(struct service *service, struct command_context *cmd_c retval = service->new_connection(c); if (retval != ERROR_OK) { LOG_ERROR("attempted '%s' connection rejected", service->name); + command_done(c->cmd_ctx); free(c); return retval; } @@ -124,6 +126,7 @@ static int add_connection(struct service *service, struct command_context *cmd_c retval = service->new_connection(c); if (retval != ERROR_OK) { LOG_ERROR("attempted '%s' connection rejected", service->name); + command_done(c->cmd_ctx); free(c); return retval; } @@ -462,9 +465,10 @@ int server_loop(struct command_context *command_context) retval = service->input(c); if (retval != ERROR_OK) { struct connection *next = c->next; - if (service->type == CONNECTION_PIPE) { + if (service->type == CONNECTION_PIPE || + service->type == CONNECTION_STDINOUT) { /* if connection uses a pipe then - *shutdown openocd on error */ + * shutdown openocd on error */ shutdown_openocd = 1; } remove_connection(service, c); @@ -635,6 +639,10 @@ SERVER_PIPE_COMMAND() break; case 1: { + if (CMD_CTX->mode == COMMAND_EXEC) { + LOG_WARNING("unable to change server port after init"); + return ERROR_COMMAND_ARGUMENT_INVALID; + } const char *t = strdup(CMD_ARGV[0]); free((void *)*out); *out = t;