/**
* collectd - src/common.c
- * Copyright (C) 2005 Florian octo Forster
+ * Copyright (C) 2005,2006 Florian octo Forster
*
* This program is free software; you can redistribute it and/
* or modify it under the terms of the GNU General Public Li-
/* * * * *
* Magic *
* * * * */
-int rra_get (char ***ret)
+#if HAVE_LIBRRD
+static int rra_get (char ***ret)
{
static char **rra_def = NULL;
static int rra_num = 0;
*ret = rra_def;
return (rra_num);
}
+#endif /* HAVE_LIBRRD */
static int log_create_file (char *filename, char **ds_def, int ds_num)
{
FILE *log;
int i;
+ if (check_create_dir (filename))
+ return (-1);
+
log = fopen (filename, "w");
if (log == NULL)
{
/* The `%.*s' is needed because there is no null-byte behind
* the name. */
- fprintf(log, ",%.*s", (tmp - name), name);
+ fprintf(log, ",%.*s", (int) (tmp - name), name);
}
fprintf(log, "\n");
fclose(log);
strncpy (full_file, file, 1024);
tmp = full_file + strlen (full_file) - 4;
- assert (tmp > 0);
+ assert ((tmp != NULL) && (tmp > full_file));
/* Change the filename for logfiles. */
if (strncmp (tmp, ".rrd", 4) == 0)