From: Sebastian Harl Date: Sun, 24 Dec 2006 13:22:49 +0000 (+0100) Subject: email plugin: Ignore size if it less than or equal to zero. X-Git-Tag: collectd-3.11.0 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=ef204ddfa3731f746a1006264bfc96984ca868bc;p=collectd.git email plugin: Ignore size if it less than or equal to zero. Some daemons (e.g. postgrey) don't provide any size information. Signed-off-by: Sebastian Harl --- diff --git a/src/collectd.pod b/src/collectd.pod index bf76055f..8ee77ea2 100644 --- a/src/collectd.pod +++ b/src/collectd.pod @@ -202,6 +202,8 @@ E-Mail type (e.g. "ham", "spam", "virus", ...) and size (bytes): e:: +If C is less than or equal to zero, C is ignored. + Spam score: s: diff --git a/src/email.c b/src/email.c index 64b82e46..509eb230 100644 --- a/src/email.c +++ b/src/email.c @@ -486,9 +486,11 @@ static void *collect (void *arg) type_list_incr (&count, type, 1); pthread_mutex_unlock (&count_mutex); - pthread_mutex_lock (&size_mutex); - type_list_incr (&size, type, bytes); - pthread_mutex_unlock (&size_mutex); + if (bytes > 0) { + pthread_mutex_lock (&size_mutex); + type_list_incr (&size, type, bytes); + pthread_mutex_unlock (&size_mutex); + } } else if ('s' == line[0]) { /* s: */ pthread_mutex_lock (&score_mutex);