Merge branch 'sh/next'
authorFlorian Forster <octo@leeloo.lan.home.verplant.org>
Sat, 8 Nov 2008 08:01:12 +0000 (09:01 +0100)
committerFlorian Forster <octo@leeloo.lan.home.verplant.org>
Sat, 8 Nov 2008 08:01:12 +0000 (09:01 +0100)
13 files changed:
ChangeLog
configure.in
contrib/collection3/bin/graph.cgi
src/Makefile.am
src/apcups.c
src/configfile.c
src/filecount.c
src/libiptc/Makefile.am
src/mysql.c
src/perl.c
src/utils_complain.c
src/utils_dns.c
src/utils_rrdcreate.c

index 26dbfd4..74a06cb 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -13,7 +13,7 @@
        * collectdmon: Don't block SIGCHLD. This fixes a potential portability
          problem.
        * collectd-nagios: Fix handling of the `-d' option. Thanks to Fabian
-         Linzberger for reporting the but.
+         Linzberger for reporting the bug.
        * iptables plugin: Fix an off-by-one error. If a string was just one
          character too long, it was truncated instead of reporting an error.
        * network plugin: Fix a memory leak in the configuration handling
@@ -25,7 +25,7 @@
          leaks. Thanks to ``Admin'' for reporting these bugs.
        * snmp plugin: Don't expect null-terminated strings from the Net-SNMP
          library.
-       * tail plugin: Call `clearerr' after reading an EOF. This fixes
+       * tail plugin: Call `clearerr(3)' after reading an EOF. This fixes
          problems with some `libc's. Thanks to Matthias Lay for reporting the
          bug.
 
        * collectdmon: Don't block SIGCHLD. This fixes a potential portability
          problem.
        * collectd-nagios: Fix handling of the `-d' option. Thanks to Fabian
-         Linzberger for reporting the but.
+         Linzberger for reporting the bug.
        * network plugin: Fix a memory leak in the configuration handling
          code. Thanks to Niraj Tolia for reporting this issue.
        * perl plugin: Log an error message if bootstrapping `Collectd' fails.
-       * tail plugin: Call `clearerr' after reading an EOF. This fixes
+       * tail plugin: Call `clearerr(3)' after reading an EOF. This fixes
          problems with some `libc's. Thanks to Matthias Lay for reporting the
          bug.
 
index 6eb2cc6..21af0b5 100644 (file)
@@ -1246,12 +1246,24 @@ then
 
        if test $mysql_config_status -ne 0
        then
-               with_libmysql="no"
+               with_libmysql="no ($with_mysql_config failed)"
        else
                SAVE_CPPFLAGS="$CPPFLAGS"
                CPPFLAGS="$CPPFLAGS $with_mysql_cflags"
 
-               AC_CHECK_HEADERS(mysql/mysql.h, [], [with_libmysql="no (mysql/mysql.h not found)"], [])
+               have_mysql_h="no"
+               have_mysql_mysql_h="no"
+               AC_CHECK_HEADERS(mysql.h, [have_mysql_h="yes"])
+
+               if test "x$have_mysql_h" = "xno"
+               then
+                       AC_CHECK_HEADERS(mysql/mysql.h, [have_mysql_mysql_h="yes"])
+               fi
+
+               if test "x$have_mysql_h$have_mysql_mysql_h" = "xnono"
+               then
+                       with_libmysql="no (mysql.h not found)"
+               fi
 
                CPPFLAGS="$SAVE_CPPFLAGS"
        fi
@@ -1263,7 +1275,7 @@ then
 
        if test $mysql_config_status -ne 0
        then
-               with_libmysql="no"
+               with_libmysql="no ($with_mysql_config failed)"
        else
                AC_CHECK_LIB(mysqlclient, mysql_init,
                 [with_libmysql="yes"],
index 1524a66..7fe2087 100755 (executable)
@@ -20,6 +20,23 @@ our $Debug = param ('debug');
 our $Begin = param ('begin');
 our $End = param ('end');
 our $GraphWidth = param ('width');
+our $OutputFormat = 'PNG';
+our $ContentType = 'image/png';
+
+if (param ('format'))
+{
+  my $temp = param ('format') || '';
+  $temp = uc ($temp);
+
+  if ($temp =~ m/^(PNG|SVG|EPS|PDF)$/)
+  {
+    $OutputFormat = $temp;
+
+    if ($OutputFormat eq 'SVG') { $ContentType = 'image/svg+xml'; }
+    elsif ($OutputFormat eq 'EPS') { $ContentType = 'image/eps'; }
+    elsif ($OutputFormat eq 'PDF') { $ContentType = 'application/pdf'; }
+  }
+}
 
 if ($Debug)
 {
@@ -141,7 +158,7 @@ flush_files ($files,
     addr => gc_get_scalar ('UnixSockAddr', undef),
     interval => gc_get_scalar ('Interval', 10));
 
-print STDOUT header (-Content_type => 'image/png',
+print STDOUT header (-Content_type => $ContentType,
   -Last_Modified => epoch_to_rfc1123 ($obj->getLastModified ()),
   -Expires => epoch_to_rfc1123 ($expires));
 
@@ -173,7 +190,7 @@ else
   }
 
   $| = 1;
-  RRDs::graph ('-', '-a', 'PNG', '--width', $GraphWidth, @timesel, @$args);
+  RRDs::graph ('-', '-a', $OutputFormat, '--width', $GraphWidth, @timesel, @$args);
   if (my $err = RRDs::error ())
   {
     print STDERR "RRDs::graph failed: $err\n";
index 8740198..b6d1a08 100644 (file)
@@ -352,7 +352,7 @@ endif
 if BUILD_PLUGIN_IPVS
 pkglib_LTLIBRARIES += ipvs.la
 ipvs_la_SOURCES = ipvs.c
-ipvs_la_CFLAGS = $(KERNEL_CFLAGS)
+ipvs_la_CFLAGS = $(AM_CFLAGS) $(KERNEL_CFLAGS)
 ipvs_la_LDFLAGS = -module -avoid-version
 collectd_LDADD += "-dlopen" ipvs.la
 collectd_DEPENDENCIES += ipvs.la
@@ -789,7 +789,7 @@ endif
 if BUILD_PLUGIN_UUID
 pkglib_LTLIBRARIES += uuid.la
 uuid_la_SOURCES = uuid.c
-uuid_la_CFLAGS  = $(BUILD_WITH_LIBHAL_CFLAGS)
+uuid_la_CFLAGS  = $(AM_CFLAGS) $(BUILD_WITH_LIBHAL_CFLAGS)
 uuid_la_LIBADD  = $(BUILD_WITH_LIBHAL_LIBS)
 uuid_la_LDFLAGS = -module -avoid-version
 collectd_LDADD += "-dlopen" uuid.la
index 227c703..ca026b9 100644 (file)
  *   Anthony Gialluca <tonyabg at charter.net>
  **/
 
-/*
- * FIXME: Don't know why but without this here atof() was not returning
- * correct values for me. This is behavior that I don't understand and
- * should be examined in closer detail.
- */
-#include <stdlib.h>
-
 #include "collectd.h"
 #include "common.h"      /* rrd_update_file */
 #include "plugin.h"      /* plugin_register, plugin_submit */
index ca0cafe..f9c20fc 100644 (file)
@@ -276,7 +276,7 @@ static int dispatch_value_plugin (const char *plugin, oconfig_item_t *ci)
        buffer_ptr = buffer + 1;
 
        return (cf_dispatch (plugin, ci->key, buffer_ptr));
-} /* int plugin_conf_dispatch */
+} /* int dispatch_value_plugin */
 
 static int dispatch_value (const oconfig_item_t *ci)
 {
index 3e6e646..e2b0020 100644 (file)
@@ -398,7 +398,7 @@ static int fc_config_add_dir (oconfig_item_t *ci)
     fc_directory_conf_t **temp;
 
     temp = (fc_directory_conf_t **) realloc (directories,
-        sizeof (*directories) * directories_num);
+        sizeof (*directories) * (directories_num + 1));
     if (temp == NULL)
     {
       ERROR ("filecount plugin: realloc failed.");
index 3a6ef67..a8ed93c 100644 (file)
@@ -10,5 +10,6 @@ noinst_LTLIBRARIES = libiptc.la
 
 libiptc_la_CFLAGS = -I$(KERNEL_DIR)/include
 libiptc_la_SOURCES = libip4tc.c libip6tc.c \
-               ipt_kernel_headers.h libip6tc.h libiptc.h linux_list.h
+               ipt_kernel_headers.h libip6tc.h libiptc.h linux_list.h \
+               xtables.h libxtc.h
 
index 312a819..4e72b5b 100644 (file)
@@ -24,7 +24,9 @@
 #include "plugin.h"
 #include "configfile.h"
 
-#ifdef HAVE_MYSQL_MYSQL_H
+#ifdef HAVE_MYSQL_H
+#include <mysql.h>
+#elif defined(HAVE_MYSQL_MYSQL_H)
 #include <mysql/mysql.h>
 #endif
 
index d9e1e00..cdfb8d5 100644 (file)
@@ -1790,7 +1790,7 @@ static int perl_config (oconfig_item_t *ci)
 
        for (i = 0; i < ci->children_num; ++i) {
                oconfig_item_t *c = ci->children + i;
-               int current_status;
+               int current_status = 0;
 
                if (NULL != perl_threads)
                        aTHX = PERL_GET_CONTEXT;
index 118245c..d5c0996 100644 (file)
@@ -21,6 +21,7 @@
  *   Sebastian tokkee Harl <sh at tokkee.org>
  **/
 
+#include "collectd.h"
 #include "utils_complain.h"
 #include "plugin.h"
 
index f2ab337..c16ca52 100644 (file)
@@ -391,7 +391,7 @@ handle_dns(const char *buf, int len,
     while ((t = strchr(qh.qname, '\r')))
        *t = ' ';
     for (t = qh.qname; *t; t++)
-       *t = tolower(*t);
+       *t = tolower((int) *t);
 
     memcpy(&us, buf + offset, 2);
     qh.qtype = ntohs(us);
index 99feda2..8ff025b 100644 (file)
@@ -253,11 +253,26 @@ static int srrd_create (const char *filename, /* {{{ */
     int argc, const char **argv)
 {
   int status;
+  char *filename_copy;
+
+  if ((filename == NULL) || (argv == NULL))
+    return (-EINVAL);
+
+  /* Some versions of librrd don't have the `const' qualifier for the first
+   * argument, so we have to copy the pointer here to avoid warnings. It sucks,
+   * but what else can we do? :(  -octo */
+  filename_copy = strdup (filename);
+  if (filename_copy == NULL)
+  {
+    ERROR ("srrd_create: strdup failed.");
+    return (-ENOMEM);
+  }
 
   optind = 0; /* bug in librrd? */
   rrd_clear_error ();
 
-  status = rrd_create_r (filename, pdp_step, last_up, argc, (void *) argv);
+  status = rrd_create_r (filename_copy, pdp_step, last_up,
+      argc, (void *) argv);
 
   if (status != 0)
   {
@@ -265,6 +280,8 @@ static int srrd_create (const char *filename, /* {{{ */
         filename, rrd_get_error ());
   }
 
+  sfree (filename_copy);
+
   return (status);
 } /* }}} int srrd_create */
 /* #endif HAVE_THREADSAFE_LIBRRD */