From: Paul Fertser Date: Fri, 15 Aug 2014 07:31:16 +0000 (+0400) Subject: transport: emit a warning when a user tries to reselect a transport X-Git-Tag: v0.9.0-rc1~304 X-Git-Url: https://review.openocd.org/gitweb?p=openocd.git;a=commitdiff_plain;h=80ea8053329d84157666ed36afb7cff73ab505a6 transport: emit a warning when a user tries to reselect a transport Even though changing transport is impossible, reselecting it should be harmless. Change-Id: I6c1c2786134e826f47f848b590e6d712b6fd2206 Signed-off-by: Paul Fertser Reviewed-on: http://openocd.zylin.com/2251 Tested-by: jenkins Reviewed-by: Spencer Oliver --- diff --git a/src/transport/transport.c b/src/transport/transport.c index 072a0d3854..3f5337e35a 100644 --- a/src/transport/transport.c +++ b/src/transport/transport.c @@ -286,9 +286,13 @@ static int jim_transport_select(Jim_Interp *interp, int argc, Jim_Obj * const *a break; case 2: /* assign */ if (session) { - /* can't change session's transport after-the-fact */ - LOG_ERROR("session's transport is already selected."); - return JIM_ERR; + if (!strcmp(session->name, argv[1]->bytes)) { + LOG_WARNING("Transport \"%s\" was already selected", session->name); + return JIM_OK; + } else { + LOG_ERROR("Can't change session's transport after the initial selection was made"); + return JIM_ERR; + } } /* Is this transport supported by our debug adapter?