diff options
author | ntfreak <ntfreak@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2008-11-26 16:43:01 +0000 |
---|---|---|
committer | ntfreak <ntfreak@b42882b7-edfa-0310-969c-e2dbd0fdcd60> | 2008-11-26 16:43:01 +0000 |
commit | 271bb81d6dea705246aba72fa9814606b93c5b30 (patch) | |
tree | 4a611c428fbb5aa1194c236053382a6d685823dd | |
parent | 9a7bbada942f926005c1bed6a45b1c0a4b0f9ef7 (diff) |
- fixes segfault using the targets cmd if multiple targets defined
git-svn-id: svn://svn.berlios.de/openocd/trunk@1187 b42882b7-edfa-0310-969c-e2dbd0fdcd60
-rw-r--r-- | src/target/target.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/target/target.c b/src/target/target.c index 79c97c24..f86c52f9 100644 --- a/src/target/target.c +++ b/src/target/target.c @@ -1362,7 +1362,7 @@ int handle_targets_command(struct command_context_s *cmd_ctx, char *cmd, char ** if (argc == 1) { /* try as tcltarget name */ - for( target = all_targets ; target ; target++ ){ + for( target = all_targets ; target ; target = target->next ){ if( target->cmd_name ){ if( 0 == strcmp( args[0], target->cmd_name ) ){ /* MATCH */ @@ -1388,8 +1388,9 @@ int handle_targets_command(struct command_context_s *cmd_ctx, char *cmd, char ** cmd_ctx->current_target = target->target_number; return ERROR_OK; } - DumpTargets: +DumpTargets: + target = all_targets; command_print(cmd_ctx, " CmdName Type Endian ChainPos State "); command_print(cmd_ctx, "-- ---------- ---------- ---------- -------- ----------"); while (target) |