diff --git a/src/utils_fbhash.c b/src/utils_fbhash.c
index cbd150610205255a8a20478a324175a7feebd35a..893bfbd49bded329e7b320cadd28c3da8c42bd5f 100644 (file)
--- a/src/utils_fbhash.c
+++ b/src/utils_fbhash.c
**/
#include "collectd.h"
-#include "plugin.h"
-#include <pthread.h>
+#include "plugin.h"
#include "utils_fbhash.h"
#include "utils_avltree.h"
{
FILE *fh;
char buffer[4096];
- struct flock fl;
+ struct flock fl = { 0 };
c_avl_tree_t *tree;
int status;
if (fh == NULL)
return (-1);
- memset (&fl, 0, sizeof (fl));
fl.l_type = F_RDLCK;
fl.l_whence = SEEK_SET;
- fl.l_start = 0;
- fl.l_len = 0; /* == entire file */
/* TODO: Lock file? -> fcntl */
status = fcntl (fileno (fh), F_SETLK, &fl);
return (-1);
}
- tree = c_avl_create ((void *) strcmp);
+ tree = c_avl_create ((int (*) (const void *, const void *)) strcmp);
if (tree == NULL)
{
fclose (fh);
static int fbh_check_file (fbhash_t *h) /* {{{ */
{
- struct stat statbuf;
+ struct stat statbuf = { 0 };
int status;
- memset (&statbuf, 0, sizeof (statbuf));
-
status = stat (h->filename, &statbuf);
if (status != 0)
return (-1);
if (file == NULL)
return (NULL);
- h = malloc (sizeof (*h));
+ h = calloc (1, sizeof (*h));
if (h == NULL)
return (NULL);
- memset (h, 0, sizeof (*h));
h->filename = strdup (file);
if (h->filename == NULL)