From: Marc Fournier Date: Tue, 19 May 2015 10:01:18 +0000 (+0200) Subject: Merge pull request #1023 from ciomaire/write_kafka_ldflags X-Git-Tag: collectd-5.5.0~26 X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=27894a14bcc5437d1e9131ea602c66c0e28fd9d1;hp=f8cecf10d4f3466fe59949554ab368ae4dd0d225;p=collectd.git Merge pull request #1023 from ciomaire/write_kafka_ldflags when --with-librdkafka arg is not a path searched by linker --- diff --git a/configure.ac b/configure.ac index e6b36937..448bb4a2 100644 --- a/configure.ac +++ b/configure.ac @@ -1190,6 +1190,7 @@ FILE *fh; struct mntent *me; fh = setmntent ("/etc/mtab", "r"); me = getmntent (fh); +return(me->mnt_passno); ]]] )], [c_cv_have_one_getmntent="yes"], @@ -1209,6 +1210,7 @@ me = getmntent (fh); int status; fh = fopen ("/etc/mnttab", "r"); status = getmntent (fh, &mt); + return(status); ]]] )], [c_cv_have_two_getmntent="yes"], @@ -2084,6 +2086,10 @@ fi # --with-java {{{ with_java_home="$JAVA_HOME" +if test "x$with_java_home" = "x" +then + with_java_home="/usr/lib/jvm" +fi with_java_vmtype="client" with_java_cflags="" with_java_libs="" @@ -2108,7 +2114,7 @@ then if test -d "$with_java_home" then AC_MSG_CHECKING([for jni.h]) - TMPVAR=`find "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1` + TMPVAR=`find -L "$with_java_home" -name jni.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1` if test "x$TMPVAR" != "x" then AC_MSG_RESULT([found in $TMPVAR]) @@ -2118,7 +2124,7 @@ then fi AC_MSG_CHECKING([for jni_md.h]) - TMPVAR=`find "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1` + TMPVAR=`find -L "$with_java_home" -name jni_md.h -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1` if test "x$TMPVAR" != "x" then AC_MSG_RESULT([found in $TMPVAR]) @@ -2128,7 +2134,7 @@ then fi AC_MSG_CHECKING([for libjvm.so]) - TMPVAR=`find "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1` + TMPVAR=`find -L "$with_java_home" -name libjvm.so -type f -exec 'dirname' '{}' ';' 2>/dev/null | head -n 1` if test "x$TMPVAR" != "x" then AC_MSG_RESULT([found in $TMPVAR]) @@ -2140,7 +2146,7 @@ then if test "x$JAVAC" = "x" then AC_MSG_CHECKING([for javac]) - TMPVAR=`find "$with_java_home" -name javac -type f 2>/dev/null | head -n 1` + TMPVAR=`find -L "$with_java_home" -name javac -type f 2>/dev/null | head -n 1` if test "x$TMPVAR" != "x" then JAVAC="$TMPVAR" @@ -2152,7 +2158,7 @@ then if test "x$JAR" = "x" then AC_MSG_CHECKING([for jar]) - TMPVAR=`find "$with_java_home" -name jar -type f 2>/dev/null | head -n 1` + TMPVAR=`find -L "$with_java_home" -name jar -type f 2>/dev/null | head -n 1` if test "x$TMPVAR" != "x" then JAR="$TMPVAR" @@ -3172,6 +3178,7 @@ then ]]], [[[ int val = PCAP_ERROR_IFACE_NOT_UP; + return(val); ]]] )], [c_cv_libpcap_have_pcap_error_iface_not_up="yes"], diff --git a/contrib/redhat/collectd.spec b/contrib/redhat/collectd.spec index e023a341..20f6dd5f 100644 --- a/contrib/redhat/collectd.spec +++ b/contrib/redhat/collectd.spec @@ -211,7 +211,7 @@ # plugin xmms disabled, requires xmms %define with_xmms 0%{!?_without_xmms:0} -Summary: Statistics collection daemon for filling RRD files +Summary: statistics collection and monitoring daemon Name: collectd Version: 5.4.2 Release: 1%{?dist} @@ -948,7 +948,7 @@ Collectd utilities %if %{with_dbi} %define _with_dbi --enable-dbi %else -%define _with_dbi --disable-dbi --without-libdbi +%define _with_dbi --disable-dbi %endif %if %{with_df} @@ -1200,7 +1200,7 @@ Collectd utilities %if %{with_notify_email} %define _with_notify_email --enable-notify_email %else -%define _with_notify_email --disable-notify_email --without-libesmpt +%define _with_notify_email --disable-notify_email %endif %if %{with_ntpd} @@ -1254,7 +1254,7 @@ Collectd utilities %if %{with_perl} %define _with_perl --enable-perl --with-perl-bindings="INSTALLDIRS=vendor" %else -%define _with_perl --disable-perl --without-libperl +%define _with_perl --disable-perl %endif %if %{with_pf} @@ -1516,7 +1516,7 @@ Collectd utilities %if %{with_write_mongodb} %define _with_write_mongodb --enable-write_mongodb %else -%define _with_write_mongodb --disable-write_mongodb --without-libmongoc +%define _with_write_mongodb --disable-write_mongodb %endif %if %{with_write_redis} @@ -1982,7 +1982,7 @@ fi %if %{with_thermal} %{_libdir}/%{name}/thermal.so %endif -%if %{with_load} +%if %{with_threshold} %{_libdir}/%{name}/threshold.so %endif %if %{with_unixsock} diff --git a/src/daemon/meta_data.c b/src/daemon/meta_data.c index d3da9bb5..6ee8446b 100644 --- a/src/daemon/meta_data.c +++ b/src/daemon/meta_data.c @@ -494,7 +494,7 @@ int meta_data_get_string (meta_data_t *md, /* {{{ */ if (e->type != MD_TYPE_STRING) { - ERROR ("meta_data_get_signed_int: Type mismatch for key `%s'", e->key); + ERROR ("meta_data_get_string: Type mismatch for key `%s'", e->key); pthread_mutex_unlock (&md->lock); return (-ENOENT); } diff --git a/src/java.c b/src/java.c index d0423be9..2f1efbf1 100644 --- a/src/java.c +++ b/src/java.c @@ -3078,10 +3078,8 @@ static int cjni_init (void) /* {{{ */ if (config_block != NULL) { - cjni_config_perform (config_block); oconfig_free (config_block); - config_block = NULL; } if (jvm == NULL) diff --git a/src/libcollectdclient/network.c b/src/libcollectdclient/network.c index ddb3b5b9..c390a1ce 100644 --- a/src/libcollectdclient/network.c +++ b/src/libcollectdclient/network.c @@ -1,6 +1,6 @@ /** * collectd - src/libcollectdclient/network.c - * Copyright (C) 2005-2013 Florian Forster + * Copyright (C) 2005-2015 Florian Forster * Copyright (C) 2010 Max Henkel * * Permission is hereby granted, free of charge, to any person obtaining a @@ -219,7 +219,13 @@ static int server_send_buffer (lcc_server_t *srv) /* {{{ */ memset (buffer, 0, sizeof (buffer)); buffer_size = sizeof (buffer); - lcc_network_buffer_finalize (srv->buffer); + status = lcc_network_buffer_finalize (srv->buffer); + if (status != 0) + { + lcc_network_buffer_initialize (srv->buffer); + return (status); + } + status = lcc_network_buffer_get (srv->buffer, buffer, &buffer_size); lcc_network_buffer_initialize (srv->buffer); diff --git a/src/libcollectdclient/network_buffer.c b/src/libcollectdclient/network_buffer.c index 61c7c22e..343c285a 100644 --- a/src/libcollectdclient/network_buffer.c +++ b/src/libcollectdclient/network_buffer.c @@ -1,6 +1,6 @@ /** * collectd - src/libcollectdclient/network_buffer.c - * Copyright (C) 2010-2012 Florian octo Forster + * Copyright (C) 2010-2015 Florian octo Forster * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), @@ -792,9 +792,9 @@ int lcc_network_buffer_finalize (lcc_network_buffer_t *nb) /* {{{ */ #if HAVE_LIBGCRYPT if (nb->seclevel == SIGN) - nb_add_signature (nb); + return nb_add_signature (nb); else if (nb->seclevel == ENCRYPT) - nb_add_encryption (nb); + return nb_add_encryption (nb); #endif return (0); diff --git a/src/liboconfig/oconfig.c b/src/liboconfig/oconfig.c index 539c9d35..bf21b90e 100644 --- a/src/liboconfig/oconfig.c +++ b/src/liboconfig/oconfig.c @@ -195,7 +195,7 @@ oconfig_item_t *oconfig_clone (const oconfig_item_t *ci_orig) return (ci_copy); } /* oconfig_item_t *oconfig_clone */ -void oconfig_free (oconfig_item_t *ci) +void oconfig_free_all (oconfig_item_t *ci) { int i; @@ -214,12 +214,19 @@ void oconfig_free (oconfig_item_t *ci) free (ci->values); for (i = 0; i < ci->children_num; i++) - oconfig_free (ci->children + i); + oconfig_free_all (ci->children + i); if (ci->children != NULL) free (ci->children); } +void oconfig_free (oconfig_item_t *ci) +{ + oconfig_free_all (ci); + free (ci); + ci = NULL; +} + /* * vim:shiftwidth=2:tabstop=8:softtabstop=2:fdm=marker */ diff --git a/src/processes.c b/src/processes.c index 68f30a5a..5a09b573 100644 --- a/src/processes.c +++ b/src/processes.c @@ -1791,7 +1791,7 @@ static int ps_read (void) int wait = 0; kvm_t *kd; - char errbuf[1024]; + char errbuf[_POSIX2_LINE_MAX]; struct kinfo_proc *procs; /* array of processes */ struct kinfo_proc *proc_ptr = NULL; int count; /* returns number of processes */ @@ -1803,7 +1803,7 @@ static int ps_read (void) ps_list_reset (); /* Open the kvm interface, get a descriptor */ - kd = kvm_open (NULL, NULL, NULL, 0, errbuf); + kd = kvm_openfiles (NULL, "/dev/null", NULL, 0, errbuf); if (kd == NULL) { ERROR ("processes plugin: Cannot open kvm interface: %s", diff --git a/src/swap.c b/src/swap.c index 8af18f4b..a8276c7d 100644 --- a/src/swap.c +++ b/src/swap.c @@ -157,6 +157,8 @@ static int swap_init (void) /* {{{ */ /* #endif defined(VM_SWAPUSAGE) */ #elif HAVE_LIBKVM_GETSWAPINFO + char errbuf[_POSIX2_LINE_MAX]; + if (kvm_obj != NULL) { kvm_close (kvm_obj); @@ -165,14 +167,11 @@ static int swap_init (void) /* {{{ */ kvm_pagesize = getpagesize (); - if ((kvm_obj = kvm_open (NULL, /* execfile */ - NULL, /* corefile */ - NULL, /* swapfile */ - O_RDONLY, /* flags */ - NULL)) /* errstr */ - == NULL) + kvm_obj = kvm_openfiles (NULL, "/dev/null", NULL, O_RDONLY, errbuf); + + if (kvm_obj == NULL) { - ERROR ("swap plugin: kvm_open failed."); + ERROR ("swap plugin: kvm_openfiles failed, %s", errbuf); return (-1); } /* #endif HAVE_LIBKVM_GETSWAPINFO */ diff --git a/src/write_sensu.c b/src/write_sensu.c index 35db4f7b..cb0c2fe2 100644 --- a/src/write_sensu.c +++ b/src/write_sensu.c @@ -484,18 +484,29 @@ static char *sensu_value_to_json(struct sensu_host const *host, /* {{{ */ return NULL; } } else { - int64_t tmp_v; - if (ds->ds[index].type == DS_TYPE_DERIVE) - tmp_v = (int64_t) vl->values[index].derive; - else if (ds->ds[index].type == DS_TYPE_ABSOLUTE) - tmp_v = (int64_t) vl->values[index].absolute; - else - tmp_v = (int64_t) vl->values[index].counter; - res = asprintf(&value_str, "%ld", tmp_v); - if (res == -1) { - free(ret_str); - ERROR("write_sensu plugin: Unable to alloc memory"); - return NULL; + if (ds->ds[index].type == DS_TYPE_DERIVE) { + res = asprintf(&value_str, "%"PRIi64, vl->values[index].derive); + if (res == -1) { + free(ret_str); + ERROR("write_sensu plugin: Unable to alloc memory"); + return NULL; + } + } + else if (ds->ds[index].type == DS_TYPE_ABSOLUTE) { + res = asprintf(&value_str, "%"PRIu64, vl->values[index].absolute); + if (res == -1) { + free(ret_str); + ERROR("write_sensu plugin: Unable to alloc memory"); + return NULL; + } + } + else { + res = asprintf(&value_str, "%llu", vl->values[index].counter); + if (res == -1) { + free(ret_str); + ERROR("write_sensu plugin: Unable to alloc memory"); + return NULL; + } } } diff --git a/version-gen.sh b/version-gen.sh index 7b573ab7..460c6e9d 100755 --- a/version-gen.sh +++ b/version-gen.sh @@ -10,4 +10,4 @@ fi VERSION="`echo \"$VERSION\" | sed -e 's/-/./g'`" -echo -n "$VERSION" +printf "%s" "$VERSION"