]> git.sur5r.net Git - openocd/commitdiff
Fixed bug in tcl-server
authorMatthias Bode <papabaer.embedded@googlemail.com>
Mon, 3 May 2010 20:35:38 +0000 (22:35 +0200)
committerØyvind Harboe <oyvind.harboe@zylin.com>
Wed, 5 May 2010 13:24:24 +0000 (15:24 +0200)
No segmentationfault when sending commands to tcl-server.

modified:   src/server/server.c
modified:   src/server/tcl_server.c
modified:   src/server/tcl_server.h

src/server/server.c
src/server/tcl_server.c
src/server/tcl_server.h

index 0d3273b3b6f741d3e22e8cd4df92e8bc271052e5..7e57228b091155f084ba47dcfa0c20a93280e4c8 100644 (file)
@@ -513,7 +513,7 @@ int server_preinit(void)
 
 int server_init(struct command_context *cmd_ctx)
 {
-       int ret = tcl_init(cmd_ctx);
+       int ret = tcl_init();
        if (ERROR_OK != ret)
                return ret;
 
index a88c4365268f613b06ee63e7734bc5da4cea8062..7c8e130ba702a8f2b660725143a08d27d938e236 100644 (file)
@@ -81,7 +81,7 @@ static int tcl_new_connection(struct connection *connection)
 
 static int tcl_input(struct connection *connection)
 {
-       Jim_Interp *interp = (Jim_Interp *)connection->priv;
+       Jim_Interp *interp = (Jim_Interp *)connection->cmd_ctx->interp;
        int retval;
        int i;
        ssize_t rlen;
@@ -157,7 +157,7 @@ static int tcl_closed(struct connection *connection)
        return ERROR_OK;
 }
 
-int tcl_init(struct command_context *cmd_ctx)
+int tcl_init(void)
 {
        int retval;
 
@@ -169,7 +169,7 @@ int tcl_init(struct command_context *cmd_ctx)
 
        retval = add_service("tcl", CONNECTION_TCP, tcl_port, 1,
                        &tcl_new_connection, &tcl_input,
-                       &tcl_closed, cmd_ctx->interp);
+                       &tcl_closed, NULL);
        return retval;
 }
 
index 68ad821280868e6ac744a308499adae8fb009cae..8035a045929e2c0645f7f77ad4cdc56a43f2a742 100644 (file)
@@ -22,7 +22,7 @@
 
 #include <server/server.h>
 
-int tcl_init(struct command_context *cmd_ctx);
+int tcl_init(void);
 int tcl_register_commands(struct command_context *cmd_ctx);
 
 #endif /* _TCL_SERVER_H_ */