X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fcsv.c;h=f9db5957d0df6abae173a2d373417a4fa694c5dc;hb=58c91485b9b28a866715fc013d23236470699940;hp=07728734cc727ab0f8991480fd27c65298aabed1;hpb=6258e772d808f4e76ea8e23d9e2750cfc7e6c60d;p=collectd.git diff --git a/src/csv.c b/src/csv.c index 07728734..f9db5957 100644 --- a/src/csv.c +++ b/src/csv.c @@ -22,6 +22,7 @@ **/ #include "collectd.h" + #include "plugin.h" #include "common.h" #include "utils_cache.h" @@ -45,7 +46,7 @@ static int value_list_to_string (char *buffer, int buffer_len, { int offset; int status; - int i; + size_t i; gauge_t *rates = NULL; assert (0 == strcmp (ds->type, vl->type)); @@ -187,7 +188,7 @@ static int value_list_to_filename (char *buffer, size_t buffer_size, static int csv_create_file (const char *filename, const data_set_t *ds) { FILE *csv; - int i; + size_t i; if (check_create_dir (filename)) return (-1); @@ -269,7 +270,7 @@ static int csv_write (const data_set_t *ds, const value_list_t *vl, char values[4096]; FILE *csv; int csv_fd; - struct flock fl; + struct flock fl = { 0 }; int status; if (0 != strcmp (ds->type, vl->type)) { @@ -342,9 +343,6 @@ static int csv_write (const data_set_t *ds, const value_list_t *vl, } csv_fd = fileno (csv); - memset (&fl, '\0', sizeof (fl)); - fl.l_start = 0; - fl.l_len = 0; /* till end of file */ fl.l_pid = getpid (); fl.l_type = F_WRLCK; fl.l_whence = SEEK_SET;