diff --git a/src/rrdtool.c b/src/rrdtool.c
index 2f28329f0fbef43f17c70b3b7136a6b4f187e2b8..bebf468c3c83ce8158a082207c7c950382bf0352 100644 (file)
--- a/src/rrdtool.c
+++ b/src/rrdtool.c
":%llu", vl->values[i].counter);
else if (ds->ds[i].type == DS_TYPE_GAUGE)
status = ssnprintf (buffer + offset, buffer_len - offset,
":%llu", vl->values[i].counter);
else if (ds->ds[i].type == DS_TYPE_GAUGE)
status = ssnprintf (buffer + offset, buffer_len - offset,
- ":%lf", vl->values[i].gauge);
+ ":"GAUGE_FORMAT, vl->values[i].gauge);
else if (ds->ds[i].type == DS_TYPE_DERIVE)
status = ssnprintf (buffer + offset, buffer_len - offset,
":%"PRIi64, vl->values[i].derive);
else if (ds->ds[i].type == DS_TYPE_DERIVE)
status = ssnprintf (buffer + offset, buffer_len - offset,
":%"PRIi64, vl->values[i].derive);
(unsigned) tt, vl->values[0].derive);
break;
case DS_TYPE_GAUGE:
(unsigned) tt, vl->values[0].derive);
break;
case DS_TYPE_GAUGE:
- status = ssnprintf (buffer, buffer_len, "%u:%lf",
+ status = ssnprintf (buffer, buffer_len, "%u:"GAUGE_FORMAT,
(unsigned) tt, vl->values[0].gauge);
break;
case DS_TYPE_COUNTER:
(unsigned) tt, vl->values[0].gauge);
break;
case DS_TYPE_COUNTER:
int status;
size_t len;
int status;
size_t len;
+ if (datadir != NULL)
+ {
+ 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;
+ }
+
status = FORMAT_VL (buffer, buffer_size, vl);
if (status != 0)
return (status);
status = FORMAT_VL (buffer, buffer_size, vl);
if (status != 0)
return (status);