From 210ff6028480df93f483131d6c6ca1f7f372aa2a Mon Sep 17 00:00:00 2001 From: Spencer Oliver Date: Tue, 21 Aug 2012 11:10:18 +0100 Subject: [PATCH] server: warn if user changes server port after init So the user can view the current port number these cmds were changed to COMMAND_ANY. However this means that the user can also attempt to change the port number after init, even though this is not supported. Issue a warning that this is not supported. Change-Id: I3d20dcd81277e7d994240a8e314f27672ff760c4 Signed-off-by: Spencer Oliver Reviewed-on: http://openocd.zylin.com/788 Tested-by: jenkins Reviewed-by: Freddie Chopin --- src/server/server.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/server/server.c b/src/server/server.c index 16f751079..96f06b3fe 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -635,6 +635,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;