X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fapcups.c;h=a0629d5f6ae0a87e13b08f1e53f6d69b0c1a85f3;hb=7658e9919a3ac9efafe4c7c2c76112ec67eeee3b;hp=462006a66a2a9447738ad60c060c2a3451c6e60f;hpb=9b0038d949ad063eab51b21c11d46b7df409e1cb;p=collectd.git diff --git a/src/apcups.c b/src/apcups.c index 462006a6..a0629d5f 100644 --- a/src/apcups.c +++ b/src/apcups.c @@ -1,10 +1,9 @@ /* * collectd - src/apcups.c - * Copyright (C) 2007 Florian octo Forster - * Copyright (C) 2006 Anthony Gialluca - * Copyright (C) 2000-2004 Kern Sibbald - * Copyright (C) 1996-99 Andre M. Hedrick - * + * Copyright (C) 2006-2007 Florian octo Forster + * Copyright (C) 2006 Anthony Gialluca + * Copyright (C) 2000-2004 Kern Sibbald + * Copyright (C) 1996-1999 Andre M. Hedrick * * This program is free software; you can redistribute it and/or * modify it under the terms of version 2 of the GNU General @@ -22,6 +21,7 @@ * * Authors: * Anthony Gialluca + * Florian octo Forster **/ #include "collectd.h" @@ -117,8 +117,7 @@ static int net_open (char *host, int port) assert ((port > 0x00000000) && (port <= 0x0000FFFF)); /* Convert the port to a string */ - snprintf (port_str, 8, "%i", port); - port_str[7] = '\0'; + ssnprintf (port_str, sizeof (port_str), "%i", port); /* Resolve name */ memset ((void *) &ai_hints, '\0', sizeof (ai_hints)); @@ -365,13 +364,13 @@ static void apc_submit_generic (char *type, char *type_inst, double value) vl.values = values; vl.values_len = 1; - vl.time = time (NULL); sstrncpy (vl.host, hostname_g, sizeof (vl.host)); sstrncpy (vl.plugin, "apcups", sizeof (vl.plugin)); sstrncpy (vl.plugin_instance, "", sizeof (vl.plugin_instance)); - strncpy (vl.type_instance, type_inst, sizeof (vl.type_instance)); + sstrncpy (vl.type, type, sizeof (vl.type)); + sstrncpy (vl.type_instance, type_inst, sizeof (vl.type_instance)); - plugin_dispatch_values (type, &vl); + plugin_dispatch_values (&vl); } static void apc_submit (struct apc_detail_s *apcups_detail)