From 262890ac49fcc58b2f0d07a2d179773289ebf115 Mon Sep 17 00:00:00 2001 From: paulo Date: Thu, 10 Dec 2009 12:10:21 +0000 Subject: Stop recursive lock checking assert --- lib/log.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) (limited to 'lib/log.c') diff --git a/lib/log.c b/lib/log.c index 81624f58..051c5164 100644 --- a/lib/log.c +++ b/lib/log.c @@ -42,6 +42,7 @@ #else #define LOCK qpt_mutex_lock(vty_mutex);++vty_lock_count; #define UNLOCK --vty_lock_count;qpt_mutex_unlock(vty_mutex); +#define ASSERTLOCKED if(vty_lock_count==0 && !vty_lock_asserted){vty_lock_asserted=1;assert(0);} #endif /* log is protected by the same mutext as vty, see comments in vty.c */ @@ -194,7 +195,7 @@ uvzlog (struct zlog *zl, int priority, const char *format, va_list args) struct timestamp_control tsctl; tsctl.already_rendered = 0; - assert(vty_lock_count); + ASSERTLOCKED /* If zlog is not specified, use default one. */ if (zl == NULL) @@ -721,6 +722,11 @@ _zlog_abort_err (const char *mess, int err, const char *file, static void zlog_abort (const char *mess) { +#ifndef NDEBUG + /* don't work about being unlocked */ + vty_lock_asserted = 1; +#endif + /* Force fallback file logging? */ if (zlog_default && !zlog_default->fp && ((logfile_fd = open_crashlog()) >= 0) && @@ -1357,3 +1363,4 @@ proto_name2num(const char *s) #undef LOCK #undef UNLOCK +#undef ASSERTLOCKED -- cgit v1.2.3