summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: b4f406d)
raw | patch | inline | side by side (parent: b4f406d)
author | octo <octo> | |
Thu, 22 Dec 2005 17:09:20 +0000 (17:09 +0000) | ||
committer | octo <octo> | |
Thu, 22 Dec 2005 17:09:20 +0000 (17:09 +0000) |
Moved an error message in `common.c'..
Moved the call to `check_create_dir' so it's run less frequently.
Moved the call to `check_create_dir' so it's run less frequently.
configure.in | patch | blob | history | |
src/common.c | patch | blob | history | |
src/configfile.h | patch | blob | history | |
src/plugin.c | patch | blob | history |
diff --git a/configure.in b/configure.in
index 976f9329c527d38d8fd7c25c00d53ea993bc23c7..1ae7ec2a648c64646206e0b1c1968a8874f5bb42 100644 (file)
--- a/configure.in
+++ b/configure.in
dnl Process this file with autoconf to produce a configure script.
-AC_INIT(collectd, 3.6.alpha0)
+AC_INIT(collectd, 3.6.alpha1)
AC_CONFIG_SRCDIR(src/collectd.c)
AC_CONFIG_HEADERS(src/config.h)
AM_INIT_AUTOMAKE(dist-bzip2)
diff --git a/src/common.c b/src/common.c
index db8fce1a99f63b9691595adcfe96a7cc511902d9..4d93f4aa2764f5394c2336a3db889ebecc87d24c 100644 (file)
--- a/src/common.c
+++ b/src/common.c
*/
for (i = 0; i < (fields_num - last_is_file); i++)
{
- /*
- * Join the components together again
- */
- if (strjoin (dir, dir_len, fields, i + 1, "/") < 0)
- return (-1);
-
/*
* Do not create directories that start with a dot. This
* prevents `../../' attacks and other likely malicious
*/
if (fields[i][0] == '.')
{
- syslog (LOG_ERR, "Cowardly refusing to create a directory that begins with a `.' (dot): `%s'", dir);
+ syslog (LOG_ERR, "Cowardly refusing to create a directory that begins with a `.' (dot): `%s'", file_orig);
return (-2);
}
+ /*
+ * Join the components together again
+ */
+ if (strjoin (dir, dir_len, fields, i + 1, "/") < 0)
+ {
+ syslog (LOG_ERR, "strjoin failed: `%s', component #%i", file_orig, i);
+ return (-1);
+ }
+
if (stat (dir, &statbuf) == -1)
{
if (errno == ENOENT)
int i, j;
int status = 0;
+ if (check_create_dir (filename))
+ return (-1);
+
argc = ds_num + rra_num + 4;
if ((argv = (char **) malloc (sizeof (char *) * (argc + 1))) == NULL)
/* host == NULL => local mode */
if (host != NULL)
{
- if (check_create_dir (host))
- return (-1);
-
if (snprintf (full_file, 1024, "%s/%s", host, file) >= 1024)
return (-1);
}
diff --git a/src/configfile.h b/src/configfile.h
index 0458360c767ff6a40ac6b17e7b9c78f00df319f7..4f82eef1e55766ac61a0b8c94a5f2285a0c4c720 100644 (file)
--- a/src/configfile.h
+++ b/src/configfile.h
* DESCRIPTION
* `cf_register' is called by plugins that wish to receive config keys. The
* plugin will then receive all keys it registered for if they're found in a
- * `<Module $type>' section.
+ * `<Plugin $type>' section.
*
* PARAMETERS
* `type' Name of the plugin (must be the same as passed to
diff --git a/src/plugin.c b/src/plugin.c
index abc08e579688e179889ca14d88f32a2fd812a9b2..98add242ce7ec84478b35e82507d8afd718792db 100644 (file)
--- a/src/plugin.c
+++ b/src/plugin.c
#ifdef HAVE_LIBRRD
if ((operating_mode == MODE_LOCAL) || (operating_mode == MODE_CLIENT))
#endif
- if (read == NULL)
+ if ((init != NULL) && (read == NULL))
syslog (LOG_NOTICE, "Plugin `%s' doesn't provide a read function.", type);
if ((p = (plugin_t *) malloc (sizeof (plugin_t))) == NULL)