author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Tue, 24 Feb 2009 09:16:19 +0000 (10:16 +0100) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Tue, 24 Feb 2009 09:16:19 +0000 (10:16 +0100) |
bindings/perl/Collectd.pm | patch | blob | history | |
contrib/cussh.pl | patch | blob | history | |
src/common.c | patch | blob | history | |
src/cpu.c | patch | blob | history | |
src/perl.c | patch | blob | history | |
src/plugin.c | patch | blob | history |
index 007367d179bca4e281a1422b116778fe51e207f0..557950cb3e5747d24832eb41b01cf9f16b5a9553 100644 (file)
# collectd - Collectd.pm
-# Copyright (C) 2007, 2008 Sebastian Harl
+# Copyright (C) 2007-2009 Sebastian Harl
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
diff --git a/contrib/cussh.pl b/contrib/cussh.pl
index c143aea319cd23de7555cc3ea3e1e01ca60d4f14..3f1f7c80e14bdeae93519cbefb2ba9ed4373e3dc 100755 (executable)
--- a/contrib/cussh.pl
+++ b/contrib/cussh.pl
#!/usr/bin/perl
#
# collectd - contrib/cussh.pl
-# Copyright (C) 2007-2008 Sebastian Harl
+# Copyright (C) 2007-2009 Sebastian Harl
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the
diff --git a/src/common.c b/src/common.c
index 2286088a7aa2a6488824f475f9d79066a2bc50f3..4aa0ebe26a1f2fb3140746698d596486956e6440 100644 (file)
--- a/src/common.c
+++ b/src/common.c
* Authors:
* Florian octo Forster <octo at verplant.org>
* Niki W. Waibel <niki.waibel@gmx.net>
+ * Sebastian Harl <sh at tokkee.org>
+ * Michał Mirosław <mirq-linux at rere.qmqm.pl>
**/
#if HAVE_CONFIG_H
diff --git a/src/cpu.c b/src/cpu.c
index 1f1284a1b046ba7d4582982e05749a790bb4d9e9..8a4e10e684ddfa370a8a5f9e6fdc38b7fc291fd4 100644 (file)
--- a/src/cpu.c
+++ b/src/cpu.c
/**
* collectd - src/cpu.c
- * Copyright (C) 2005-2007 Florian octo Forster
+ * Copyright (C) 2005-2009 Florian octo Forster
+ * Copyright (C) 2009 Simon Kuhnle
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
*
* Authors:
* Florian octo Forster <octo at verplant.org>
+ * Simon Kuhnle <simon at blarzwurst.de>
**/
#include "collectd.h"
diff --git a/src/perl.c b/src/perl.c
index 96ba802445b7e6e1aa56b2de17aeec597cda2a74..b6e7b22d27bcf724603d7f85f9a6a86da6ed99d4 100644 (file)
--- a/src/perl.c
+++ b/src/perl.c
/**
* collectd - src/perl.c
- * Copyright (C) 2007, 2008 Sebastian Harl
+ * Copyright (C) 2007-2009 Sebastian Harl
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
diff --git a/src/plugin.c b/src/plugin.c
index 856ec1a01f89fbddadf744b81b7b31d5d202345b..d185ef2fb3d6c0be41e861ffe4baed6bb5f8de6e 100644 (file)
--- a/src/plugin.c
+++ b/src/plugin.c
int status;
static c_complain_t no_write_complaint = C_COMPLAIN_INIT_STATIC;
+ value_t *saved_values;
+ int saved_values_len;
+
data_set_t *ds;
- if ((vl == NULL) || (*vl->type == '\0')) {
+ if ((vl == NULL) || (vl->type[0] == 0)
+ || (vl->values == NULL) || (vl->values_len < 1))
+ {
ERROR ("plugin_dispatch_values: Invalid value list.");
return (-1);
}
escape_slashes (vl->type, sizeof (vl->type));
escape_slashes (vl->type_instance, sizeof (vl->type_instance));
+ /* Copy the values. This way, we can assure `targets' that they get
+ * dynamically allocated values, which they can free and replace if
+ * they like. */
+ if ((pre_cache_chain != NULL) || (post_cache_chain != NULL))
+ {
+ saved_values = vl->values;
+ saved_values_len = vl->values_len;
+
+ vl->values = (value_t *) calloc (vl->values_len,
+ sizeof (*vl->values));
+ if (vl->values == NULL)
+ {
+ ERROR ("plugin_dispatch_values: calloc failed.");
+ vl->values = saved_values;
+ return (-1);
+ }
+ memcpy (vl->values, saved_values,
+ vl->values_len * sizeof (*vl->values));
+ }
+ else /* if ((pre == NULL) && (post == NULL)) */
+ {
+ saved_values = NULL;
+ saved_values_len = 0;
+ }
+
if (pre_cache_chain != NULL)
{
status = fc_process_chain (ds, vl, pre_cache_chain);
status, status);
}
else if (status == FC_TARGET_STOP)
+ {
+ /* Restore the state of the value_list so that plugins
+ * don't get confused.. */
+ if (saved_values != NULL)
+ {
+ free (vl->values);
+ vl->values = saved_values;
+ vl->values_len = saved_values_len;
+ }
return (0);
+ }
}
/* Update the value cache */
else
fc_default_action (ds, vl);
+ /* Restore the state of the value_list so that plugins don't get
+ * confused.. */
+ if (saved_values != NULL)
+ {
+ free (vl->values);
+ vl->values = saved_values;
+ vl->values_len = saved_values_len;
+ }
+
return (0);
} /* int plugin_dispatch_values */