X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=blobdiff_plain;f=src%2Fserver%2Fserver.c;h=5169319c54905d0b8886ae7ccebf683374652189;hp=1499e73875b94612c0bac5ffc5520d5c2038a231;hb=558279c1bb6fb2e39b68ac5020f5cb8271e54a9d;hpb=fc302a025270ee6e1099aa58c1c833b0d080e4ce;ds=sidebyside diff --git a/src/server/server.c b/src/server/server.c index 1499e73875..5169319c54 100644 --- a/src/server/server.c +++ b/src/server/server.c @@ -21,7 +21,7 @@ * You should have received a copy of the GNU General Public License * * along with this program; if not, write to the * * Free Software Foundation, Inc., * - * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. * ***************************************************************************/ #ifdef HAVE_CONFIG_H @@ -80,7 +80,7 @@ static int add_connection(struct service *service, struct command_context *cmd_c (char *)&flag, /* the cast is historical cruft */ sizeof(int)); /* length of option value */ - LOG_INFO("accepting '%s' connection from %s", service->name, service->port); + LOG_INFO("accepting '%s' connection on tcp/%s", service->name, service->port); retval = service->new_connection(c); if (retval != ERROR_OK) { close_socket(c->fd); @@ -303,14 +303,14 @@ static int remove_services(void) struct service *next = c->next; if (c->name) - free((void *)c->name); + free(c->name); if (c->type == CONNECTION_PIPE) { if (c->fd != -1) close(c->fd); } if (c->port) - free((void *)c->port); + free(c->port); if (c->priv) free(c->priv); @@ -465,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); @@ -611,7 +612,7 @@ int server_register_commands(struct command_context *cmd_ctx) return register_commands(cmd_ctx, NULL, server_command_handlers); } -SERVER_PORT_COMMAND() +COMMAND_HELPER(server_port_command, unsigned short *out) { switch (CMD_ARGC) { case 0: @@ -630,7 +631,7 @@ SERVER_PORT_COMMAND() return ERROR_OK; } -SERVER_PIPE_COMMAND() +COMMAND_HELPER(server_pipe_command, char **out) { switch (CMD_ARGC) { case 0: @@ -642,9 +643,8 @@ SERVER_PIPE_COMMAND() 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; + free(*out); + *out = strdup(CMD_ARGV[0]); break; } default: