X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fcpu.c;h=66cd261a13f74e7cc340432a52707af6e5f0bf4e;hb=1d4cdb75eeb13910a640520c2e3192f962045b0d;hp=7692e2b56fdb0423689450ba2d6702fe224a509f;hpb=250dc17bfb3c5488b789347f1f570913701d31ca;p=collectd.git diff --git a/src/cpu.c b/src/cpu.c index 7692e2b5..66cd261a 100644 --- a/src/cpu.c +++ b/src/cpu.c @@ -1,6 +1,7 @@ /** * collectd - src/cpu.c - * Copyright (C) 2005-2007 Florian octo Forster + * Copyright (C) 2005-2009 Florian octo Forster + * Copyright (C) 2008 Oleg King * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -17,6 +18,7 @@ * * Authors: * Florian octo Forster + * Oleg King **/ #include "collectd.h" @@ -180,14 +182,14 @@ static void submit (int cpu_num, const char *type_instance, counter_t value) vl.values = values; vl.values_len = 1; vl.time = time (NULL); - strcpy (vl.host, hostname_g); - strcpy (vl.plugin, "cpu"); - snprintf (vl.plugin_instance, sizeof (vl.type_instance), + sstrncpy (vl.host, hostname_g, sizeof (vl.host)); + sstrncpy (vl.plugin, "cpu", sizeof (vl.plugin)); + ssnprintf (vl.plugin_instance, sizeof (vl.type_instance), "%i", cpu_num); - vl.plugin_instance[DATA_MAX_NAME_LEN - 1] = '\0'; - strcpy (vl.type_instance, type_instance); + sstrncpy (vl.type, "cpu", sizeof (vl.type)); + sstrncpy (vl.type_instance, type_instance, sizeof (vl.type_instance)); - plugin_dispatch_values ("cpu", &vl); + plugin_dispatch_values (&vl); } static int cpu_read (void)