From: Florian Forster Date: Tue, 27 May 2008 15:21:42 +0000 (+0200) Subject: processes plugin: Fixed the config callback to return the right values. X-Git-Tag: collectd-4.5.0~139 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=3ff4d313fc9e0bc1f7d435b88f902d509ce47137;p=collectd.git processes plugin: Fixed the config callback to return the right values. --- 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)