From: Kern Sibbald Date: Fri, 23 Oct 2009 15:05:00 +0000 (+0200) Subject: Disallow Qmsg when despooling X-Git-Tag: Release-7.0.0~2598^2~58 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=59c59f9e3b59ce4c73269163abc3a35f16915d16;p=bacula%2Fbacula Disallow Qmsg when despooling --- diff --git a/bacula/src/jcr.h b/bacula/src/jcr.h index 16a4d7d2d8..58ae568437 100644 --- a/bacula/src/jcr.h +++ b/bacula/src/jcr.h @@ -214,6 +214,7 @@ public: JCR_free_HANDLER *daemon_free_jcr; /* Local free routine */ dlist *msg_queue; /* Queued messages */ pthread_mutex_t msg_queue_mutex; /* message queue mutex */ + bool dequeuing_msgs; /* Set when dequeuing messages */ alist job_end_push; /* Job end pushed calls */ POOLMEM *VolumeName; /* Volume name desired -- pool_memory */ POOLMEM *errmsg; /* edited error message */ diff --git a/bacula/src/lib/message.c b/bacula/src/lib/message.c index d9abff3bcc..6cb762d874 100644 --- a/bacula/src/lib/message.c +++ b/bacula/src/lib/message.c @@ -1361,6 +1361,13 @@ void Qmsg(JCR *jcr, int type, utime_t mtime, const char *fmt,...) /* jcr==NULL => daemon message, safe to send now */ Jmsg(jcr, item->type, item->mtime, "%s", item->msg); free(item); + /* + * If we are dequeuing, we cannot queue another item, + * so as a last resort send it to the syslog + */ + } else if (jcr->dequeuing_msgs) { + syslog(LOG_DAEMON|LOG_ERR, "%s", item->msg); + free(item); } else { /* Queue message for later sending */ P(jcr->msg_queue_mutex); @@ -1380,11 +1387,13 @@ void dequeue_messages(JCR *jcr) return; } P(jcr->msg_queue_mutex); + jcr->dequeuing_msgs = true; foreach_dlist(item, jcr->msg_queue) { Jmsg(jcr, item->type, item->mtime, "%s", item->msg); } /* Remove messages just sent */ jcr->msg_queue->destroy(); + jcr->dequeuing_msgs = false; V(jcr->msg_queue_mutex); }