From 3ff4d313fc9e0bc1f7d435b88f902d509ce47137 Mon Sep 17 00:00:00 2001 From: Florian Forster Date: Tue, 27 May 2008 17:21:42 +0200 Subject: [PATCH] processes plugin: Fixed the config callback to return the right values. --- src/processes.c | 26 ++++++++++++++------------ 1 file changed, 14 insertions(+), 12 deletions(-) diff --git a/src/processes.c b/src/processes.c index 67471341..79451d32 100644 --- a/src/processes.c +++ b/src/processes.c @@ -426,33 +426,35 @@ static void ps_list_reset (void) /* put all pre-defined 'Process' names from config to list_head_g tree */ static int ps_config (const char *key, const char *value) { - char *new_val; - char *fields[2]; - int fields_num; - if (strcasecmp (key, "Process") == 0) { ps_list_register (value, NULL); - return (0); } - - if (strcasecmp (key, "ProcessMatch") == 0) + else if (strcasecmp (key, "ProcessMatch") == 0) { + char *new_val; + char *fields[3]; + int fields_num; + new_val = strdup (value); if (new_val == NULL) - return (-1); - fields_num = strsplit (new_val, fields, 2); + return (1); + fields_num = strsplit (new_val, fields, + STATIC_ARRAY_SIZE (fields)); if (fields_num != 2) { sfree (new_val); - return (-1); + return (1); } ps_list_register (fields[0], fields[1]); sfree (new_val); - return (0); + } + else + { + return (-1); } - return (-1); + return (0); } static int ps_init (void) -- 2.11.0