X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Futils_fbhash.c;h=893bfbd49bded329e7b320cadd28c3da8c42bd5f;hb=e1bfa71aca1f37c2f293dc9adb44065c6e7a9ad9;hp=d1a580cd632420d0ab25e9a6186d5210e63d6b55;hpb=b599cc64d3ba270fb9fb7116631a01b7404f1a9b;p=collectd.git diff --git a/src/utils_fbhash.c b/src/utils_fbhash.c index d1a580cd..893bfbd4 100644 --- a/src/utils_fbhash.c +++ b/src/utils_fbhash.c @@ -25,6 +25,7 @@ **/ #include "collectd.h" + #include "plugin.h" #include "utils_fbhash.h" @@ -69,7 +70,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; @@ -77,11 +78,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); @@ -177,11 +175,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);