X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fload.c;h=575b4ca44d8698258a636602df47f2ec0da76c67;hb=b324ebf63ff9117d5f8facb97342925606d373cc;hp=db3bf4b8b88c96debc7bfabf66c33ca680d00e31;hpb=f05e9721b9ea58d6ea4a8295a80cede2d6b327d1;p=collectd.git diff --git a/src/load.c b/src/load.c index db3bf4b8..575b4ca4 100644 --- a/src/load.c +++ b/src/load.c @@ -1,6 +1,6 @@ /** * collectd - src/load.c - * Copyright (C) 2005-2007 Florian octo Forster + * Copyright (C) 2005-2008 Florian octo Forster * * 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 @@ -19,6 +19,8 @@ * Florian octo Forster **/ +#define _BSD_SOURCE + #include "collectd.h" #include "common.h" #include "plugin.h" @@ -50,11 +52,11 @@ static void load_submit (gauge_t snum, gauge_t mnum, gauge_t lnum) vl.values = values; vl.values_len = STATIC_ARRAY_SIZE (values); - vl.time = time (NULL); - strcpy (vl.host, hostname_g); - strcpy (vl.plugin, "load"); + sstrncpy (vl.host, hostname_g, sizeof (vl.host)); + sstrncpy (vl.plugin, "load", sizeof (vl.plugin)); + sstrncpy (vl.type, "load", sizeof (vl.type)); - plugin_dispatch_values ("load", &vl); + plugin_dispatch_values (&vl); } static int load_read (void) @@ -79,7 +81,7 @@ static int load_read (void) char *fields[8]; int numfields; - + if ((loadavg = fopen ("/proc/loadavg", "r")) == NULL) { char errbuf[1024]; @@ -116,7 +118,7 @@ static int load_read (void) load_submit (snum, mnum, lnum); /* #endif KERNEL_LINUX */ -#elif defined(HAVE_LIBSTATGRAB) +#elif HAVE_LIBSTATGRAB gauge_t snum, mnum, lnum; sg_load_stats *ls;