summaryrefslogtreecommitdiffstats
path: root/lib/log.c
diff options
context:
space:
mode:
authorChris Hall (GMCH) <chris.hall@highwayman.com>2009-12-10 21:29:13 +0000
committerChris Hall (GMCH) <chris.hall@highwayman.com>2009-12-10 21:29:13 +0000
commit224a85d77aea7077ce7aec038d7abe3bb3b049ea (patch)
tree9cfad7112b2bbc78982f62fda99a85093d1421e3 /lib/log.c
parent3f41e4bfc9c17a17b425c1872ef99ddcc42e3e28 (diff)
parent7f6da094bad38e3593e475a81a28f1833d911c46 (diff)
downloadquagga-224a85d77aea7077ce7aec038d7abe3bb3b049ea.tar.bz2
quagga-224a85d77aea7077ce7aec038d7abe3bb3b049ea.tar.xz
Merge branch 'pthreads' of /git/quagga.euro-ix into pthreads
Diffstat (limited to 'lib/log.c')
-rw-r--r--lib/log.c9
1 files changed, 8 insertions, 1 deletions
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