X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Futils_fbhash.c;h=d980f58605c1750d3451d7647b3f50fdbd5f03ee;hb=71bbf854d3e6f8c6d6c3582527263bb01a3a7e04;hp=41f640af5a835652b73fb943523cb352dff726fd;hpb=2ce1db8202b1eba6da45b347c0c81a508f8c088a;p=collectd.git diff --git a/src/utils_fbhash.c b/src/utils_fbhash.c index 41f640af..d980f586 100644 --- a/src/utils_fbhash.c +++ b/src/utils_fbhash.c @@ -69,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; @@ -77,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); @@ -91,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); @@ -177,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);