X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Futils_rrdcreate.c;h=da4a944afc60f3c0870aa04b0b1e11bc01df2a02;hb=49bd12d05d940a4e4b129c29e56599a8098f2164;hp=a34e0da0103936de01b652996cb956b5d327f93a;hpb=a38c24034ce1831ebfaa41ca6231bb15e17086a7;p=collectd.git diff --git a/src/utils_rrdcreate.c b/src/utils_rrdcreate.c index a34e0da0..da4a944a 100644 --- a/src/utils_rrdcreate.c +++ b/src/utils_rrdcreate.c @@ -99,6 +99,7 @@ static void srrd_create_args_destroy (srrd_create_args_t *args) sfree (args->argv[i]); sfree (args->argv); } + sfree (args); } /* void srrd_create_args_destroy */ static srrd_create_args_t *srrd_create_args_create (const char *filename, @@ -703,18 +704,32 @@ int cu_rrd_create_file (const char *filename, /* {{{ */ } else /* synchronous */ { - status = srrd_create (filename, stepsize, last_up, - argc, (const char **) argv); - + status = lock_file (filename); if (status != 0) { - WARNING ("cu_rrd_create_file: srrd_create (%s) returned status %i.", - filename, status); + if (status == EEXIST) + NOTICE ("cu_rrd_create_file: File \"%s\" is already being created.", + filename); + else + ERROR ("cu_rrd_create_file: Unable to lock file \"%s\".", + filename); } else { - DEBUG ("cu_rrd_create_file: Successfully created RRD file \"%s\".", - filename); + status = srrd_create (filename, stepsize, last_up, + argc, (const char **) argv); + + if (status != 0) + { + WARNING ("cu_rrd_create_file: srrd_create (%s) returned status %i.", + filename, status); + } + else + { + DEBUG ("cu_rrd_create_file: Successfully created RRD file \"%s\".", + filename); + } + unlock_file (filename); } }