summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: dc61df5)
raw | patch | inline | side by side (parent: dc61df5)
author | Manuel Luis Sanmartin Rozada <manuel.luis@gmail.com> | |
Mon, 5 Aug 2013 23:05:01 +0000 (01:05 +0200) | ||
committer | Florian Forster <octo@collectd.org> | |
Wed, 7 Aug 2013 07:41:52 +0000 (09:41 +0200) |
In the commit 7f90e30 the re-implementation of value_list_to_filename
forgot to prepend the datadir string.
Signed-off-by: Florian Forster <octo@collectd.org>
forgot to prepend the datadir string.
Signed-off-by: Florian Forster <octo@collectd.org>
src/csv.c | patch | blob | history |
diff --git a/src/csv.c b/src/csv.c
index afb4f8338c5d7e2611e489338eda5a642f3c56b8..f123c5d6dae1960d6fe91a53c16765d27eda4356 100644 (file)
--- a/src/csv.c
+++ b/src/csv.c
{
int status;
- char *ptr;
- size_t ptr_size;
+ char *ptr = buffer;
+ size_t ptr_size = buffer_size;
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 (use_stdio)
return (0);
- ptr_size = buffer_size - strlen (buffer);
- ptr = buffer + strlen (buffer);
+ ptr_size -= strlen (ptr);
+ ptr += strlen (ptr);
/* "-2013-07-12" => 11 bytes */
if (ptr_size < 12)