[collectd] [PATCH] perl plugin: Fixed handling of erroneous configuration options.

Sebastian Harl sh at tokkee.org
Wed Oct 17 01:14:18 CEST 2007


An empty block was used instead of returning from the perl_config_*()
functions in case of an error. I wonder how that has happened... :-/

Signed-off-by: Sebastian Harl <sh at tokkee.org>
---
 src/perl.c |   16 ++++++++--------
 1 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/src/perl.c b/src/perl.c
index c0beabf..47844eb 100644
--- a/src/perl.c
+++ b/src/perl.c
@@ -907,8 +907,8 @@ static int perl_config_loadplugin (oconfig_item_t *ci)
 	char *value = NULL;
 
 	if ((0 != ci->children_num) || (1 != ci->values_num)
-			|| (OCONFIG_TYPE_STRING != ci->values[0].type)) {
-	}
+			|| (OCONFIG_TYPE_STRING != ci->values[0].type))
+		return 1;
 
 	value = ci->values[0].value.string;
 
@@ -934,8 +934,8 @@ static int perl_config_basename (oconfig_item_t *ci)
 	char *value = NULL;
 
 	if ((0 != ci->children_num) || (1 != ci->values_num)
-			|| (OCONFIG_TYPE_STRING != ci->values[0].type)) {
-	}
+			|| (OCONFIG_TYPE_STRING != ci->values[0].type))
+		return 1;
 
 	value = ci->values[0].value.string;
 
@@ -953,8 +953,8 @@ static int perl_config_enabledebugger (oconfig_item_t *ci)
 	char *value = NULL;
 
 	if ((0 != ci->children_num) || (1 != ci->values_num)
-			|| (OCONFIG_TYPE_STRING != ci->values[0].type)) {
-	}
+			|| (OCONFIG_TYPE_STRING != ci->values[0].type))
+		return 1;
 
 	value = ci->values[0].value.string;
 
@@ -987,8 +987,8 @@ static int perl_config_includedir (oconfig_item_t *ci)
 	char *value = NULL;
 
 	if ((0 != ci->children_num) || (1 != ci->values_num)
-			|| (OCONFIG_TYPE_STRING != ci->values[0].type)) {
-	}
+			|| (OCONFIG_TYPE_STRING != ci->values[0].type))
+		return 1;
 
 	value = ci->values[0].value.string;
 
-- 
1.5.3.4.206.g58ba4

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
Url : http://mailman.verplant.org/pipermail/collectd/attachments/20071017/10468e25/attachment.pgp 


More information about the collectd mailing list