X-Git-Url: https://git.verplant.org/?a=blobdiff_plain;f=src%2Futils_fbhash.c;h=d980f58605c1750d3451d7647b3f50fdbd5f03ee;hb=3fae5596643f1e361eb18c3d65448f8bc02fdd80;hp=f27c08272cb5cde3734975236164943bcd2757bd;hpb=10b10a6718dbb87c6890d4bc821a6e21c8b7b527;p=collectd.git diff --git a/src/utils_fbhash.c b/src/utils_fbhash.c index f27c0827..d980f586 100644 --- a/src/utils_fbhash.c +++ b/src/utils_fbhash.c @@ -27,8 +27,6 @@ #include "collectd.h" #include "plugin.h" -#include - #include "utils_fbhash.h" #include "utils_avltree.h" @@ -71,7 +69,7 @@ static int fbh_read_file (fbhash_t *h) /* {{{ */ { FILE *fh; char buffer[4096]; - struct flock fl; + struct flock fl = { 0 }; c_avl_tree_t *tree; int status; @@ -79,11 +77,8 @@ static int fbh_read_file (fbhash_t *h) /* {{{ */ 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); @@ -93,7 +88,7 @@ static int fbh_read_file (fbhash_t *h) /* {{{ */ return (-1); } - tree = c_avl_create ((void *) strcmp); + tree = c_avl_create ((int (*) (const void *, const void *)) strcmp); if (tree == NULL) { fclose (fh); @@ -179,11 +174,9 @@ static int fbh_read_file (fbhash_t *h) /* {{{ */ 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);