projects
/
collectd.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'collectd-5.4' into collectd-5.5
[collectd.git]
/
src
/
csv.c
diff --git
a/src/csv.c
b/src/csv.c
index
afb4f83
..
b6e535e
100644
(file)
--- a/
src/csv.c
+++ b/
src/csv.c
@@
-17,7
+17,7
@@
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
*
* Authors:
- * Florian octo Forster <octo at
verplant
.org>
+ * Florian octo Forster <octo at
collectd
.org>
* Doug MacEachern <dougm@hyperic.com>
**/
* Doug MacEachern <dougm@hyperic.com>
**/
@@
-25,7
+25,6
@@
#include "plugin.h"
#include "common.h"
#include "utils_cache.h"
#include "plugin.h"
#include "common.h"
#include "utils_cache.h"
-#include "utils_parse_option.h"
/*
* Private variables
/*
* Private variables
@@
-126,12
+125,25
@@
static int value_list_to_filename (char *buffer, size_t buffer_size,
{
int status;
{
int status;
- char *ptr;
- size_t ptr_size;
+ char *ptr
= buffer
;
+ size_t ptr_size
= buffer_size
;
time_t now;
struct tm struct_tm;
time_t now;
struct tm struct_tm;
- status = FORMAT_VL (buffer, buffer_size, vl);
+ if (datadir != NULL)
+ {
+ size_t len = strlen (datadir) + 1;
+
+ if (len >= ptr_size)
+ return (ENOBUFS);
+
+ memcpy (ptr, datadir, len);
+ ptr[len-1] = '/';
+ ptr_size -= len;
+ ptr += len;
+ }
+
+ status = FORMAT_VL (ptr, ptr_size, vl);
if (status != 0)
return (status);
if (status != 0)
return (status);
@@
-140,8
+152,8
@@
static int value_list_to_filename (char *buffer, size_t buffer_size,
if (use_stdio)
return (0);
if (use_stdio)
return (0);
- ptr_size
= buffer_size - strlen (buffe
r);
- ptr
= buffer + strlen (buffe
r);
+ ptr_size
-= strlen (pt
r);
+ ptr
+= strlen (pt
r);
/* "-2013-07-12" => 11 bytes */
if (ptr_size < 12)
/* "-2013-07-12" => 11 bytes */
if (ptr_size < 12)
@@
-202,7
+214,10
@@
static int csv_config (const char *key, const char *value)
if (strcasecmp ("DataDir", key) == 0)
{
if (datadir != NULL)
if (strcasecmp ("DataDir", key) == 0)
{
if (datadir != NULL)
+ {
free (datadir);
free (datadir);
+ datadir = NULL;
+ }
if (strcasecmp ("stdout", value) == 0)
{
use_stdio = 1;
if (strcasecmp ("stdout", value) == 0)
{
use_stdio = 1;