summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 4776178)
raw | patch | inline | side by side (parent: 4776178)
author | Dagobert Michelsen <dam@opencsw.org> | |
Thu, 28 May 2015 11:06:04 +0000 (13:06 +0200) | ||
committer | Dagobert Michelsen <dam@opencsw.org> | |
Thu, 28 May 2015 11:06:04 +0000 (13:06 +0200) |
src/zone.c | patch | blob | history |
diff --git a/src/zone.c b/src/zone.c
index 1781775ff90b68a5a4abba5af4792ea086175b40..325d556701563910099a7ff662e609c98abb937f 100644 (file)
--- a/src/zone.c
+++ b/src/zone.c
#include "utils_avltree.h"
#define MAX_PROCFS_PATH 40
-#define MAX_ZONE_NAME 20
#define FRC2PCT(pp)(((float)(pp))/0x8000*100)
typedef struct zone_stats {
static void
zone_submit_values(c_avl_tree_t *tree)
{
- char zonename[MAX_ZONE_NAME];
+ char zonename[ZONENAME_MAX];
zoneid_t *zoneid = NULL;
zone_stats_t *stats = NULL;
while (c_avl_pick (tree, (void **)&zoneid, (void **)&stats) == 0)
{
- getzonenamebyid(*zoneid, zonename, MAX_ZONE_NAME-1);
- zone_submit_value(zonename, (gauge_t)FRC2PCT(stats->pctcpu));
+ if (getzonenamebyid(*zoneid, zonename, sizeof( zonename )) == -1) {
+ WARNING("zone plugin: error retreiving zonename");
+ } else {
+ zone_submit_value(zonename, (gauge_t)FRC2PCT(stats->pctcpu));
+ }
free(stats);
free(zoneid);
}