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 <spen@spen-soft.co.uk>
Reviewed-on: http://openocd.zylin.com/788
Tested-by: jenkins
Reviewed-by: Freddie Chopin <freddie.chopin@gmail.com>
__archive__
Spencer Oliver 2012-08-21 11:10:18 +01:00 committed by Freddie Chopin
parent 9a8aa4ec63
commit 210ff60284
1 changed files with 4 additions and 0 deletions

View File

@ -635,6 +635,10 @@ SERVER_PIPE_COMMAND()
break; break;
case 1: 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]); const char *t = strdup(CMD_ARGV[0]);
free((void *)*out); free((void *)*out);
*out = t; *out = t;