email plugin: Ignore size if it less than or equal to zero. collectd-3.11.0
authorSebastian Harl <sh@tokkee.org>
Sun, 24 Dec 2006 13:22:49 +0000 (14:22 +0100)
committerFlorian Forster <octo@huhu.verplant.org>
Tue, 9 Jan 2007 13:54:31 +0000 (14:54 +0100)
Some daemons (e.g. postgrey) don't provide any size information.

Signed-off-by: Sebastian Harl <sh@tokkee.org>
src/collectd.pod
src/email.c

index bf76055..8ee77ea 100644 (file)
@@ -202,6 +202,8 @@ E-Mail type (e.g. "ham", "spam", "virus", ...) and size (bytes):
 
   e:<type>:<size>
 
+If C<size> is less than or equal to zero, C<size> is ignored.
+
 Spam score:
 
   s:<value>
index 64b82e4..509eb23 100644 (file)
@@ -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:<value> */
                                pthread_mutex_lock (&score_mutex);