From dc61df5bf2ec9fe2c2aea6142505a73b3406d8e3 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Wed, 24 Jul 2013 15:36:00 +0200 Subject: [PATCH] rrdcached, rrdtool plugins: Add directory separator after datadir. D'oh! Thanks to @rcpoison for pointing this out! Github: #380 --- src/rrdcached.c | 5 ++++- src/rrdtool.c | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/rrdcached.c b/src/rrdcached.c index a8305e63..33f05e73 100644 --- a/src/rrdcached.c +++ b/src/rrdcached.c @@ -121,12 +121,15 @@ static int value_list_to_filename (char *buffer, size_t buffer_size, if (datadir != NULL) { - size_t datadir_len = strlen (datadir); + size_t datadir_len = strlen (datadir) + 1; if (datadir_len >= buffer_size) return (ENOMEM); sstrncpy (buffer, datadir, buffer_size); + buffer[datadir_len - 1] = '/'; + buffer[datadir_len] = 0; + buffer += datadir_len; buffer_size -= datadir_len; } diff --git a/src/rrdtool.c b/src/rrdtool.c index a4688674..0ffbd122 100644 --- a/src/rrdtool.c +++ b/src/rrdtool.c @@ -249,12 +249,15 @@ static int value_list_to_filename (char *buffer, size_t buffer_size, if (datadir != NULL) { - size_t datadir_len = strlen (datadir); + size_t datadir_len = strlen (datadir) + 1; if (datadir_len >= buffer_size) return (ENOMEM); sstrncpy (buffer, datadir, buffer_size); + buffer[datadir_len - 1] = '/'; + buffer[datadir_len] = 0; + buffer += datadir_len; buffer_size -= datadir_len; } -- 2.30.2