Merge branch 'collectd-5.4' into collectd-5.5
authorFlorian Forster <octo@collectd.org>
Wed, 17 Jun 2015 07:12:26 +0000 (09:12 +0200)
committerFlorian Forster <octo@collectd.org>
Wed, 17 Jun 2015 07:12:26 +0000 (09:12 +0200)
README
src/daemon/utils_avltree.c
src/daemon/utils_llist.c
src/liboconfig/oconfig.c
src/liboconfig/scanner.l
src/network.c
src/perl.c
src/target_notification.c
src/utils_rrdcreate.c

diff --git a/README b/README
index 9604fda..3e2c023 100644 (file)
--- a/README
+++ b/README
@@ -464,7 +464,7 @@ Features
       database.
 
   * Logging is, as everything in collectd, provided by plugins. The following
-    plugins keep up informed about what's going on:
+    plugins keep us informed about what's going on:
 
     - logfile
       Writes log messages to a file or STDOUT/STDERR.
index 04e5403..da793b3 100644 (file)
@@ -617,10 +617,18 @@ int c_avl_pick (c_avl_tree_t *t, void **key, void **value)
        n = t->root;
        while ((n->left != NULL) || (n->right != NULL))
        {
-               int height_left  = (n->left  == NULL) ? 0 : n->left->height;
-               int height_right = (n->right == NULL) ? 0 : n->right->height;
+               if (n->left == NULL)
+               {
+                       n = n->right;
+                       continue;
+               }
+               else if (n->right == NULL)
+               {
+                       n = n->left;
+                       continue;
+               }
 
-               if (height_left > height_right)
+               if (n->left->height > n->right->height)
                        n = n->left;
                else
                        n = n->right;
index 09c9834..4265286 100644 (file)
@@ -123,6 +123,9 @@ void llist_remove (llist_t *l, llentry_t *e)
 {
        llentry_t *prev;
 
+       if ((l == NULL) || (e == NULL))
+               return;
+
        prev = l->head;
        while ((prev != NULL) && (prev->next != e))
                prev = prev->next;
index bf21b90..f422f5a 100644 (file)
@@ -33,6 +33,7 @@
 #include "oconfig.h"
 
 extern FILE *yyin;
+extern int yyparse (void);
 
 oconfig_item_t *ci_root;
 const char     *c_file;
index cb3754d..08524fd 100644 (file)
  */
 
 %{
+/* lex and yacc do some weird stuff, so turn off some warnings. */
+#if defined(__clang__)
+# pragma clang diagnostic ignored "-Wunused-function"
+# pragma clang diagnostic ignored "-Wunneeded-internal-declaration"
+#endif
+
 #include <stdlib.h>
 #include "oconfig.h"
 #include "aux_types.h"
index 551bd5c..2b66f1e 100644 (file)
@@ -2027,6 +2027,7 @@ static sockent_t *sockent_create (int type) /* {{{ */
        if (type == SOCKENT_TYPE_SERVER)
        {
                se->data.server.fd = NULL;
+               se->data.server.fd_num = 0;
 #if HAVE_LIBGCRYPT
                se->data.server.security_level = SECURITY_LEVEL_NONE;
                se->data.server.auth_file = NULL;
@@ -2240,6 +2241,9 @@ static int sockent_server_listen (sockent_t *se) /* {{{ */
        if (se == NULL)
                return (-1);
 
+       assert (se->data.server.fd == NULL);
+       assert (se->data.server.fd_num == 0);
+
         node = se->node;
         service = se->service;
 
index cc8faeb..a964cce 100644 (file)
@@ -516,7 +516,6 @@ static int av2notification_meta (pTHX_ AV *array, notification_meta_t **meta)
                if (NULL == (tmp = hv_fetch (hash, "value", 5, 0))) {
                        log_warn ("av2notification_meta: Skipping invalid "
                                        "meta information.");
-                       free ((*m)->name);
                        free (*m);
                        continue;
                }
index 2e5ab3b..ceb454e 100644 (file)
@@ -181,7 +181,7 @@ static int tn_create (const oconfig_item_t *ci, void **user_data) /* {{{ */
 
   if (status != 0)
   {
-    tn_destroy ((void *) data);
+    tn_destroy ((void *) &data);
     return (status);
   }
 
index 0e2d86c..220446a 100644 (file)
@@ -709,18 +709,32 @@ int cu_rrd_create_file (const char *filename, /* {{{ */
   }
   else /* synchronous */
   {
-    status = srrd_create (filename, stepsize, last_up,
-        argc, (const char **) argv);
-
+    status = lock_file (filename);
     if (status != 0)
     {
-      WARNING ("cu_rrd_create_file: srrd_create (%s) returned status %i.",
-          filename, status);
+      if (status == EEXIST)
+        NOTICE ("cu_rrd_create_file: File \"%s\" is already being created.",
+            filename);
+      else
+        ERROR ("cu_rrd_create_file: Unable to lock file \"%s\".",
+            filename);
     }
     else
     {
-      DEBUG ("cu_rrd_create_file: Successfully created RRD file \"%s\".",
-          filename);
+      status = srrd_create (filename, stepsize, last_up,
+          argc, (const char **) argv);
+
+      if (status != 0)
+      {
+        WARNING ("cu_rrd_create_file: srrd_create (%s) returned status %i.",
+            filename, status);
+      }
+      else
+      {
+        DEBUG ("cu_rrd_create_file: Successfully created RRD file \"%s\".",
+            filename);
+      }
+      unlock_file (filename);
     }
   }