summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4330a21)
raw | patch | inline | side by side (parent: 4330a21)
author | Florian Forster <octo@huhu.verplant.org> | |
Fri, 7 Nov 2008 18:49:52 +0000 (19:49 +0100) | ||
committer | Florian Forster <octo@huhu.verplant.org> | |
Fri, 7 Nov 2008 18:49:52 +0000 (19:49 +0100) |
Some versions of librrd, for example the one in Debian Etch, don't have the
`const' qualifier for the first (filename) argument for `rrd_create_r'. So
we'll copy the argument first. This sucks big time, but is the only reasonable
way to get around this.
`const' qualifier for the first (filename) argument for `rrd_create_r'. So
we'll copy the argument first. This sucks big time, but is the only reasonable
way to get around this.
src/utils_rrdcreate.c | patch | blob | history |
diff --git a/src/utils_rrdcreate.c b/src/utils_rrdcreate.c
index 99feda257f5533c20523728e9f46058ea38d9897..8ff025bdf848731be525e14db1ab5e49ace7abcf 100644 (file)
--- a/src/utils_rrdcreate.c
+++ b/src/utils_rrdcreate.c
int argc, const char **argv)
{
int status;
+ char *filename_copy;
+
+ if ((filename == NULL) || (argv == NULL))
+ return (-EINVAL);
+
+ /* Some versions of librrd don't have the `const' qualifier for the first
+ * argument, so we have to copy the pointer here to avoid warnings. It sucks,
+ * but what else can we do? :( -octo */
+ filename_copy = strdup (filename);
+ if (filename_copy == NULL)
+ {
+ ERROR ("srrd_create: strdup failed.");
+ return (-ENOMEM);
+ }
optind = 0; /* bug in librrd? */
rrd_clear_error ();
- status = rrd_create_r (filename, pdp_step, last_up, argc, (void *) argv);
+ status = rrd_create_r (filename_copy, pdp_step, last_up,
+ argc, (void *) argv);
if (status != 0)
{
filename, rrd_get_error ());
}
+ sfree (filename_copy);
+
return (status);
} /* }}} int srrd_create */
/* #endif HAVE_THREADSAFE_LIBRRD */