From: Florian Forster Date: Fri, 18 May 2007 15:08:19 +0000 (+0200) Subject: email plugin: Only submit `spam_score' if any mails have been processed. X-Git-Tag: collectd-4.0.0~35 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=bcff0d04f54998382828fe26c85448c436321cd5;p=collectd.git email plugin: Only submit `spam_score' if any mails have been processed. --- diff --git a/src/email.c b/src/email.c index 5d011d36..039c5853 100644 --- a/src/email.c +++ b/src/email.c @@ -780,7 +780,8 @@ static int email_read (void) { type_t *ptr; - double sc; + double score_old; + int score_count_old; static type_list_t *cnt; static type_list_t *sz; @@ -829,13 +830,15 @@ static int email_read (void) /* spam score */ pthread_mutex_lock (&score_mutex); - sc = score; + score_old = score; + score_count_old = score_count; score = 0.0; score_count = 0; pthread_mutex_unlock (&score_mutex); - email_submit ("spam_score", "", sc); + if (score_count_old > 0) + email_submit ("spam_score", "", score_old); /* spam checks */ pthread_mutex_lock (&check_mutex);