From: Florian Forster Date: Wed, 24 Jul 2013 13:36:00 +0000 (+0200) Subject: rrdcached, rrdtool plugins: Add directory separator after datadir. X-Git-Tag: collectd-5.4.0~1^2^2~4 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=dc61df5bf2ec9fe2c2aea6142505a73b3406d8e3;p=collectd.git rrdcached, rrdtool plugins: Add directory separator after datadir. D'oh! Thanks to @rcpoison for pointing this out! Github: #380 --- 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; }