Merge branch 'collectd-5.8'
authorFlorian Forster <octo@collectd.org>
Fri, 1 Dec 2017 10:25:18 +0000 (11:25 +0100)
committerFlorian Forster <octo@collectd.org>
Fri, 1 Dec 2017 10:25:18 +0000 (11:25 +0100)
1  2 
src/rrdtool.c

diff --combined src/rrdtool.c
@@@ -520,7 -520,10 +520,7 @@@ static void rrd_cache_flush(cdtime_t ti
      {
        char **tmp = realloc(keys, (keys_num + 1) * sizeof(char *));
        if (tmp == NULL) {
 -        char errbuf[1024];
 -        ERROR("rrdtool plugin: "
 -              "realloc failed: %s",
 -              sstrerror(errno, errbuf, sizeof(errbuf)));
 +        ERROR("rrdtool plugin: realloc failed: %s", STRERRNO);
          c_avl_iterator_destroy(iter);
          sfree(keys);
          return;
@@@ -649,12 -652,15 +649,12 @@@ static int rrd_cache_insert(const char 
    values_new =
        realloc((void *)rc->values, (rc->values_num + 1) * sizeof(char *));
    if (values_new == NULL) {
 -    char errbuf[1024];
      void *cache_key = NULL;
  
 -    sstrerror(errno, errbuf, sizeof(errbuf));
 -
      c_avl_remove(cache, filename, &cache_key, NULL);
      pthread_mutex_unlock(&cache_lock);
  
 -    ERROR("rrdtool plugin: realloc failed: %s", errbuf);
 +    ERROR("rrdtool plugin: realloc failed: %s", STRERRNO);
  
      sfree(cache_key);
      sfree(rc->values);
      void *cache_key = strdup(filename);
  
      if (cache_key == NULL) {
 -      char errbuf[1024];
 -      sstrerror(errno, errbuf, sizeof(errbuf));
 -
        pthread_mutex_unlock(&cache_lock);
  
 -      ERROR("rrdtool plugin: strdup failed: %s", errbuf);
 +      ERROR("rrdtool plugin: strdup failed: %s", STRERRNO);
  
        sfree(rc->values[0]);
        sfree(rc->values);
@@@ -794,7 -803,7 +794,7 @@@ static int rrd_write(const data_set_t *
    if (value_list_to_filename(filename, sizeof(filename), vl) != 0)
      return -1;
  
-   char values[32 * ds->ds_num];
+   char values[32 * (ds->ds_num + 1)];
    if (value_list_to_string(values, sizeof(values), ds, vl) != 0)
      return -1;
  
          return 0;
        }
      } else {
 -      char errbuf[1024];
 -      ERROR("rrdtool plugin: stat(%s) failed: %s", filename,
 -            sstrerror(errno, errbuf, sizeof(errbuf)));
 +      ERROR("rrdtool plugin: stat(%s) failed: %s", filename, STRERRNO);
        return -1;
      }
    } else if (!S_ISREG(statbuf.st_mode)) {