Pushed on top of the command help cleanup series.

--Z

On Tue, 2009-11-10 at 23:22 -0800, Zachary T Welch wrote:
> Without this patch, running "openocd -c 'jtag interface'" segfaults.
> Now, it returns the string "undefined" when the interface is unset.
> ---
> Is there a better value that could be returned, or is this okay?
> 
> Cheers,
> 
> Zach
> 
>  src/jtag/tcl.c |    3 ++-
>  1 files changed, 2 insertions(+), 1 deletions(-)
> 
> diff --git a/src/jtag/tcl.c b/src/jtag/tcl.c
> index 71efc8b..b86e006 100644
> --- a/src/jtag/tcl.c
> +++ b/src/jtag/tcl.c
> @@ -422,7 +422,8 @@ static int jim_jtag_command(Jim_Interp *interp, int argc, 
> Jim_Obj *const *argv)
>                       Jim_WrongNumArgs(goi.interp, 1, goi.argv-1, "(no 
> params)");
>                       return JIM_ERR;
>               }
> -             Jim_SetResultString(goi.interp, jtag_interface->name, -1);
> +             const char *name = jtag_interface ? jtag_interface->name : NULL;
> +             Jim_SetResultString(goi.interp, name ? : "undefined", -1);
>               return JIM_OK;
>       case JTAG_CMD_INIT:
>               if (goi.argc != 0) {


_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to