static pthread_mutex_t librrd_lock = PTHREAD_MUTEX_INITIALIZER;
#endif
-static async_create_file_t *async_creation_list = NULL;
+static async_create_file_t *async_creation_list;
static pthread_mutex_t async_creation_lock = PTHREAD_MUTEX_INITIALIZER;
/*
if (rra_num >= rra_max)
break;
- status = ssnprintf(buffer, sizeof(buffer), "RRA:%s:%.10f:%u:%u",
- rra_types[j], cfg->xff, cdp_len, cdp_num);
+ status = snprintf(buffer, sizeof(buffer), "RRA:%s:%.10f:%u:%u",
+ rra_types[j], cfg->xff, cdp_len, cdp_num);
if ((status < 0) || ((size_t)status >= sizeof(buffer))) {
ERROR("rra_get: Buffer would have been truncated.");
ds_def = calloc(ds->ds_num, sizeof(*ds_def));
if (ds_def == NULL) {
- char errbuf[1024];
- ERROR("rrdtool plugin: calloc failed: %s",
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ ERROR("rrdtool plugin: calloc failed: %s", STRERRNO);
return -1;
}
if (isnan(d->min)) {
sstrncpy(min, "U", sizeof(min));
} else
- ssnprintf(min, sizeof(min), "%f", d->min);
+ snprintf(min, sizeof(min), "%f", d->min);
if (isnan(d->max)) {
sstrncpy(max, "U", sizeof(max));
} else
- ssnprintf(max, sizeof(max), "%f", d->max);
+ snprintf(max, sizeof(max), "%f", d->max);
- status = ssnprintf(buffer, sizeof(buffer), "DS:%s:%s:%i:%s:%s", d->name,
- type, (cfg->heartbeat > 0)
- ? cfg->heartbeat
- : (int)CDTIME_T_TO_TIME_T(2 * vl->interval),
- min, max);
+ status = snprintf(
+ buffer, sizeof(buffer), "DS:%s:%s:%i:%s:%s", d->name, type,
+ (cfg->heartbeat > 0) ? cfg->heartbeat
+ : (int)CDTIME_T_TO_TIME_T(2 * vl->interval),
+ min, max);
if ((status < 1) || ((size_t)status >= sizeof(buffer)))
break;
if (last_up == 0)
last_up = time(NULL) - 10;
- ssnprintf(pdp_step_str, sizeof(pdp_step_str), "%lu", pdp_step);
- ssnprintf(last_up_str, sizeof(last_up_str), "%lu", (unsigned long)last_up);
+ snprintf(pdp_step_str, sizeof(pdp_step_str), "%lu", pdp_step);
+ snprintf(last_up_str, sizeof(last_up_str), "%lu", (unsigned long)last_up);
new_argv[0] = "create";
new_argv[1] = (void *)filename;
return 0;
}
- ssnprintf(tmpfile, sizeof(tmpfile), "%s.async", args->filename);
+ snprintf(tmpfile, sizeof(tmpfile), "%s.async", args->filename);
status = srrd_create(tmpfile, args->pdp_step, args->last_up, args->argc,
(void *)args->argv);
status = rename(tmpfile, args->filename);
if (status != 0) {
- char errbuf[1024];
ERROR("srrd_create_thread: rename (\"%s\", \"%s\") failed: %s", tmpfile,
- args->filename, sstrerror(errno, errbuf, sizeof(errbuf)));
+ args->filename, STRERRNO);
unlink(tmpfile);
unlock_file(args->filename);
srrd_create_args_destroy(args);
status = pthread_create(&thread, &attr, srrd_create_thread, args);
if (status != 0) {
- char errbuf[1024];
- ERROR("srrd_create_async: pthread_create failed: %s",
- sstrerror(status, errbuf, sizeof(errbuf)));
+ ERROR("srrd_create_async: pthread_create failed: %s", STRERROR(status));
pthread_attr_destroy(&attr);
srrd_create_args_destroy(args);
return status;
argc = ds_num + rra_num;
if ((argv = malloc(sizeof(*argv) * (argc + 1))) == NULL) {
- char errbuf[1024];
- ERROR("cu_rrd_create_file failed: %s",
- sstrerror(errno, errbuf, sizeof(errbuf)));
+ ERROR("cu_rrd_create_file failed: %s", STRERRNO);
rra_free(rra_num, rra_def);
ds_free(ds_num, ds_def);
return -1;