/*****************************************************************************
- * RRDtool 1.2.99907080300 Copyright by Tobi Oetiker, 1997-2007
+ * RRDtool 1.3rc7 Copyright by Tobi Oetiker, 1997-2008
*****************************************************************************
* rrd_info Get Information about the configuration of an RRD
*****************************************************************************/
char *fmt,
...)
{
-#ifdef HAVE_VSNPRINTF
- int maxlen = 50;
-#else
- int maxlen = 1000;
-#endif
+ int maxlen = 1024 + strlen(fmt);
char *str = NULL;
va_list argp;
- str = malloc(sizeof(char) * (strlen(fmt) + maxlen));
+ str = malloc(sizeof(char) * (maxlen+1));
if (str != NULL) {
va_start(argp, fmt);
#ifdef HAVE_VSNPRINTF
- vsnprintf(str, maxlen - 1, fmt, argp);
+ vsnprintf(str, maxlen, fmt, argp);
#else
vsprintf(str, fmt, argp);
#endif
break;
case RD_I_BLO:
next->value.u_blo.size = value.u_blo.size;
- next->value.u_blo.ptr = malloc(sizeof(unsigned char)*value.u_blo.size);
- memcpy(next->value.u_blo.ptr,value.u_blo.ptr,value.u_blo.size);
+ next->value.u_blo.ptr =
+ malloc(sizeof(unsigned char) * value.u_blo.size);
+ memcpy(next->value.u_blo.ptr, value.u_blo.ptr, value.u_blo.size);
break;
}
return (next);
void info_print(
info_t *data)
{
- long image_length = 0;
-
while (data) {
printf("%s = ", data->key);
case RD_I_STR:
printf("\"%s\"\n", data->value.u_str);
break;
- case RD_I_BLO:
+ case RD_I_BLO:
printf("BLOB_SIZE:%lu\n", data->value.u_blo.size);
fwrite(data->value.u_blo.ptr, data->value.u_blo.size, 1, stdout);
break;