Merge branch 'collectd-5.7'
authorFlorian Forster <octo@collectd.org>
Thu, 21 Sep 2017 15:26:23 +0000 (17:26 +0200)
committerFlorian Forster <octo@collectd.org>
Thu, 21 Sep 2017 15:26:23 +0000 (17:26 +0200)
contrib/redhat/collectd.spec
src/network.c
src/ntpd.c
src/perl.c

index 66d1914..23cac9a 100644 (file)
@@ -521,8 +521,8 @@ the byte- and packet-counters of selected rules and submit them to collectd.
 Summary:       Java plugin for collectd
 Group:         System Environment/Daemons
 Requires:      %{name}%{?_isa} = %{version}-%{release}
-BuildRequires: java-devel, jpackage-utils
-Requires:      java, jpackage-utils
+BuildRequires: java-devel >= 1.6, jpackage-utils >= 1.6
+Requires:      java >= 1.6, jpackage-utils >= 1.6
 %description java
 This plugin for collectd allows plugins to be written in Java and executed
 in an embedded JVM.
index 375da84..4e68421 100644 (file)
@@ -1230,9 +1230,9 @@ static int parse_part_encr_aes256(sockent_t *se, /* {{{ */
                             part_size - buffer_offset,
                             /* in = */ NULL, /* in len = */ 0);
   if (err != 0) {
-    sfree(pea.username);
     ERROR("network plugin: gcry_cipher_decrypt returned: %s. Username: %s",
           gcry_strerror(err), pea.username);
+    sfree(pea.username);
     return -1;
   }
 
@@ -1254,8 +1254,6 @@ static int parse_part_encr_aes256(sockent_t *se, /* {{{ */
   parse_packet(se, buffer + buffer_offset, payload_len, flags | PP_ENCRYPTED,
                pea.username);
 
-  /* XXX: Free pea.username?!? */
-
   /* Update return values */
   *ret_buffer = buffer + part_size;
   *ret_buffer_len = buffer_len - part_size;
@@ -2652,10 +2650,10 @@ static int network_write(const data_set_t *ds, const value_list_t *vl,
 
   pthread_mutex_lock(&send_buffer_lock);
 
-  status = add_to_buffer(send_buffer_ptr,
-                         network_config_packet_size -
-                             (send_buffer_fill + BUFF_SIG_SIZE),
-                         &send_buffer_vl, ds, vl);
+  status =
+      add_to_buffer(send_buffer_ptr, network_config_packet_size -
+                                         (send_buffer_fill + BUFF_SIG_SIZE),
+                    &send_buffer_vl, ds, vl);
   if (status >= 0) {
     /* status == bytes added to the buffer */
     send_buffer_fill += status;
@@ -2666,10 +2664,10 @@ static int network_write(const data_set_t *ds, const value_list_t *vl,
   } else {
     flush_buffer();
 
-    status = add_to_buffer(send_buffer_ptr,
-                           network_config_packet_size -
-                               (send_buffer_fill + BUFF_SIG_SIZE),
-                           &send_buffer_vl, ds, vl);
+    status =
+        add_to_buffer(send_buffer_ptr, network_config_packet_size -
+                                           (send_buffer_fill + BUFF_SIG_SIZE),
+                      &send_buffer_vl, ds, vl);
 
     if (status >= 0) {
       send_buffer_fill += status;
index a19d05c..48d7aa7 100644 (file)
@@ -846,9 +846,9 @@ static int ntpd_read(void) {
   }
 
   /* kerninfo -> estimated error */
-  offset_loop = scale_loop * ((gauge_t)ntohl(ik->offset));
+  offset_loop = (gauge_t)((int32_t)ntohl(ik->offset) * scale_loop);
   freq_loop = ntpd_read_fp(ik->freq);
-  offset_error = scale_error * ((gauge_t)ntohl(ik->esterror));
+  offset_error = (gauge_t)((int32_t)ntohl(ik->esterror) * scale_error);
 
   DEBUG("info_kernel:\n"
         "  pll offset    = %.8g\n"
index a1ac8d7..d2a00bf 100644 (file)
@@ -2616,6 +2616,12 @@ static int perl_config_plugin(pTHX_ oconfig_item_t *ci) {
   char *plugin;
   HV *config;
 
+  if (NULL == perl_threads) {
+    log_err("A `Plugin' block was encountered but no plugin was loaded yet. "
+            "Put the appropriate `LoadPlugin' option in front of it.");
+    return -1;
+  }
+
   dSP;
 
   if ((1 != ci->values_num) || (OCONFIG_TYPE_STRING != ci->values[0].type)) {