aboutsummaryrefslogtreecommitdiff
path: root/src/helper
diff options
context:
space:
mode:
authoroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-03-04 13:13:55 +0000
committeroharboe <oharboe@b42882b7-edfa-0310-969c-e2dbd0fdcd60>2008-03-04 13:13:55 +0000
commitf955b90d28874dc238a03178503a804b3c38582a (patch)
treee32ef1b5f318e43e5f7ce1cb25b39ff459863615 /src/helper
parent5a6dc5a325756132ce20be598c278022c7b1c185 (diff)
downloadriscv-openocd-f955b90d28874dc238a03178503a804b3c38582a.zip
riscv-openocd-f955b90d28874dc238a03178503a804b3c38582a.tar.gz
riscv-openocd-f955b90d28874dc238a03178503a804b3c38582a.tar.bz2
Fixed GDB timeout crash - regression introduced back when log_add/remove_callback was added.
git-svn-id: svn://svn.berlios.de/openocd/trunk@442 b42882b7-edfa-0310-969c-e2dbd0fdcd60
Diffstat (limited to 'src/helper')
-rw-r--r--src/helper/log.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/helper/log.c b/src/helper/log.c
index cdd7b7b..b389872 100644
--- a/src/helper/log.c
+++ b/src/helper/log.c
@@ -60,8 +60,6 @@ static int count = 0;
*/
static void log_puts(enum log_levels level, const char *file, int line, const char *function, const char *string)
{
- log_callback_t *cb;
-
if (level == LOG_OUTPUT)
{
/* do not prepend any headers, just print out what we were given and return */
@@ -98,10 +96,14 @@ static void log_puts(enum log_levels level, const char *file, int line, const ch
/* Never forward LOG_DEBUG, too verbose and they can be found in the log if need be */
if (level <= LOG_INFO)
{
- log_callback_t *cb;
- for (cb = log_callbacks; cb; cb = cb->next)
+ log_callback_t *cb, *next;
+ cb = log_callbacks;
+ /* DANGER!!!! the log callback can remove itself!!!! */
+ while (cb)
{
+ next=cb->next;
cb->fn(cb->priv, file, line, function, string);
+ cb=next;
}
}
}