summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 07a3dec)
raw | patch | inline | side by side (parent: 07a3dec)
author | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Tue, 13 May 2008 14:49:40 +0000 (16:49 +0200) | ||
committer | Florian Forster <octo@leeloo.lan.home.verplant.org> | |
Tue, 13 May 2008 14:49:40 +0000 (16:49 +0200) |
src/rrdtool.c | patch | blob | history |
diff --git a/src/rrdtool.c b/src/rrdtool.c
index 6b9c5404c736c3bb9561bb9ff7d4946acf709a1b..eafb8607960182a564078d9717470aac485b9a5f 100644 (file)
--- a/src/rrdtool.c
+++ b/src/rrdtool.c
rrd_cache_t *rc;
time_t now;
int status;
- char *key;
- size_t key_size;
+ char key[2048];
if (identifier == NULL)
{
now = time (NULL);
- key_size = strlen (identifier + 5) * sizeof (char);
- key = (char *) malloc (key_size);
- if (key == NULL)
- {
- ERROR ("rrdtool plugin: rrd_cache_flush_identifier: malloc failed.");
- return (-1);
- }
- snprintf (key, key_size, "%s.rrd", identifier);
- key[key_size - 1] = 0;
+ if (datadir == NULL)
+ snprintf (key, sizeof (key), "%s.rrd",
+ identifier);
+ else
+ snprintf (key, sizeof (key), "%s/%s.rrd",
+ datadir, identifier);
+ key[sizeof (key) - 1] = 0;
status = c_avl_get (cache, key, (void *) &rc);
if (status != 0)