summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: d8e1728)
raw | patch | inline | side by side (parent: d8e1728)
author | Florian Forster <octo@collectd.org> | |
Sat, 10 Nov 2012 20:40:20 +0000 (21:40 +0100) | ||
committer | Florian Forster <octo@collectd.org> | |
Sat, 10 Nov 2012 20:40:20 +0000 (21:40 +0100) |
The resulting error message would confuse and annoy users.
src/aggregation.c | patch | blob | history |
diff --git a/src/aggregation.c b/src/aggregation.c
index 985fa7c35873c008b705be3aa45422c96d53fd99..a924223481c42d5a1b611eedd0370aa558f8cf22 100644 (file)
--- a/src/aggregation.c
+++ b/src/aggregation.c
pthread_mutex_lock (&agg_instance_list_lock);
+ /* agg_instance_list_head only holds data, after the "write" callback has
+ * been called with a matching value list at least once. So on startup,
+ * there's a race between the aggregations read() and write() callback. If
+ * the read() callback is called first, agg_instance_list_head is NULL and
+ * "success" may be zero. This is expected and should not result in an error.
+ * Therefore we need to handle this case separately. */
+ if (agg_instance_list_head == NULL)
+ {
+ pthread_mutex_unlock (&agg_instance_list_lock);
+ return (0);
+ }
+
for (this = agg_instance_list_head; this != NULL; this = this->next)
{
int status;