summary | shortlog | log | commit | commitdiff | tree
raw | patch | inline | side by side (parent: 867ad62)
raw | patch | inline | side by side (parent: 867ad62)
author | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Sun, 2 Jul 2017 19:17:30 +0000 (21:17 +0200) | ||
committer | Ruben Kerkhof <ruben@rubenkerkhof.com> | |
Sun, 2 Jul 2017 19:17:30 +0000 (21:17 +0200) |
ssnprintf supposedly was a safer version of snprintf, but they both
always NUL-terminate the buffer.
After this change GCC >= 7 will start warning when snprintf silenty
truncates, which is good since I want to see when that happens.
always NUL-terminate the buffer.
After this change GCC >= 7 will start warning when snprintf silenty
truncates, which is good since I want to see when that happens.
113 files changed:
diff --git a/src/aggregation.c b/src/aggregation.c
index ffee1cd4b9489eb904eb87145d2e5fab10466955..493f17e3ae641c881d0e112788f95c4b3c193403 100644 (file)
--- a/src/aggregation.c
+++ b/src/aggregation.c
sstrncpy(inst->ident.plugin_instance, AGG_FUNC_PLACEHOLDER,
sizeof(inst->ident.plugin_instance));
else if (strcmp("", tmp_plugin) != 0)
- ssnprintf(inst->ident.plugin_instance,
+ snprintf(inst->ident.plugin_instance,
sizeof(inst->ident.plugin_instance), "%s-%s", tmp_plugin,
AGG_FUNC_PLACEHOLDER);
else if (strcmp("", tmp_plugin_instance) != 0)
- ssnprintf(inst->ident.plugin_instance,
+ snprintf(inst->ident.plugin_instance,
sizeof(inst->ident.plugin_instance), "%s-%s",
tmp_plugin_instance, AGG_FUNC_PLACEHOLDER);
else
- ssnprintf(inst->ident.plugin_instance,
+ snprintf(inst->ident.plugin_instance,
sizeof(inst->ident.plugin_instance), "%s-%s-%s", tmp_plugin,
tmp_plugin_instance, AGG_FUNC_PLACEHOLDER);
}
diff --git a/src/amqp.c b/src/amqp.c
index 1adc62718e2a95c43fbcaa9f7ad456102019f734..73bc1a2961e22d43dcf4b60299ba86b254588517 100644 (file)
--- a/src/amqp.c
+++ b/src/amqp.c
if (r.reply.id == AMQP_CONNECTION_CLOSE_METHOD) {
amqp_connection_close_t *m = r.reply.decoded;
char *tmp = camqp_bytes_cstring(&m->reply_text);
- ssnprintf(buffer, buffer_size, "Server connection error %d: %s",
+ snprintf(buffer, buffer_size, "Server connection error %d: %s",
m->reply_code, tmp);
sfree(tmp);
} else if (r.reply.id == AMQP_CHANNEL_CLOSE_METHOD) {
amqp_channel_close_t *m = r.reply.decoded;
char *tmp = camqp_bytes_cstring(&m->reply_text);
- ssnprintf(buffer, buffer_size, "Server channel error %d: %s",
+ snprintf(buffer, buffer_size, "Server channel error %d: %s",
m->reply_code, tmp);
sfree(tmp);
} else {
- ssnprintf(buffer, buffer_size, "Server error method %#" PRIx32,
+ snprintf(buffer, buffer_size, "Server error method %#" PRIx32,
r.reply.id);
}
break;
default:
- ssnprintf(buffer, buffer_size, "Unknown reply type %i", (int)r.reply_type);
+ snprintf(buffer, buffer_size, "Unknown reply type %i", (int)r.reply_type);
}
return buffer;
if (conf->routing_key != NULL) {
sstrncpy(routing_key, conf->routing_key, sizeof(routing_key));
} else {
- ssnprintf(routing_key, sizeof(routing_key), "collectd/%s/%s/%s/%s/%s",
+ snprintf(routing_key, sizeof(routing_key), "collectd/%s/%s/%s/%s/%s",
vl->host, vl->plugin, vl->plugin_instance, vl->type,
vl->type_instance);
if (publish) {
char cbname[128];
- ssnprintf(cbname, sizeof(cbname), "amqp/%s", conf->name);
+ snprintf(cbname, sizeof(cbname), "amqp/%s", conf->name);
status = plugin_register_write(
cbname, camqp_write, &(user_data_t){
diff --git a/src/apache.c b/src/apache.c
index e2f75c180ae219dfeb81d7abfdfa5fda0b54db25..a3630800a62d2efaf4aa882eab8100d49fe342e1 100644 (file)
--- a/src/apache.c
+++ b/src/apache.c
if (status == 0) {
char callback_name[3 * DATA_MAX_NAME_LEN];
- ssnprintf(callback_name, sizeof(callback_name), "apache/%s/%s",
+ snprintf(callback_name, sizeof(callback_name), "apache/%s/%s",
(st->host != NULL) ? st->host : hostname_g,
(st->name != NULL) ? st->name : "default");
static char credentials[1024];
int status;
- status = ssnprintf(credentials, sizeof(credentials), "%s:%s", st->user,
+ status = snprintf(credentials, sizeof(credentials), "%s:%s", st->user,
(st->pass == NULL) ? "" : st->pass);
if ((status < 0) || ((size_t)status >= sizeof(credentials))) {
ERROR("apache plugin: init_host: Returning an error "
diff --git a/src/ascent.c b/src/ascent.c
index 16f9104618207c85313f3e4f128e622fd4875c54..678a4a152fcc97bde1620681dc12a27cc1f00654 100644 (file)
--- a/src/ascent.c
+++ b/src/ascent.c
static char credentials[1024];
int status;
- status = ssnprintf(credentials, sizeof(credentials), "%s:%s", user,
+ status = snprintf(credentials, sizeof(credentials), "%s:%s", user,
(pass == NULL) ? "" : pass);
if ((status < 0) || ((size_t)status >= sizeof(credentials))) {
ERROR("ascent plugin: ascent_init: Returning an error because the "
diff --git a/src/battery.c b/src/battery.c
index 5a0b089f949fa4d942b94a577e309830d3642d25..ba08aa695b4b55cebdb5499e3208bff141096065 100644 (file)
--- a/src/battery.c
+++ b/src/battery.c
char filename[PATH_MAX];
int status;
- ssnprintf(filename, sizeof(filename), "%s/%s/%s", dir, power_supply,
+ snprintf(filename, sizeof(filename), "%s/%s/%s", dir, power_supply,
basename);
status = (int)read_file_contents(filename, buffer, buffer_size - 1);
FILE *fh;
- ssnprintf(filename, sizeof(filename), "%s/%s/info", dir, power_supply);
+ snprintf(filename, sizeof(filename), "%s/%s/info", dir, power_supply);
fh = fopen(filename, "r");
if (fh == NULL)
return errno;
FILE *fh;
- ssnprintf(filename, sizeof(filename), "%s/%s/state", dir, power_supply);
+ snprintf(filename, sizeof(filename), "%s/%s/state", dir, power_supply);
fh = fopen(filename, "r");
if (fh == NULL) {
if ((errno == EAGAIN) || (errno == EINTR) || (errno == ENOENT))
gauge_t voltage = NAN;
gauge_t charge = NAN;
- ssnprintf(filename, sizeof(filename), PROC_PMU_PATH_FORMAT, i);
+ snprintf(filename, sizeof(filename), PROC_PMU_PATH_FORMAT, i);
if (access(filename, R_OK) != 0)
break;
- ssnprintf(plugin_instance, sizeof(plugin_instance), "%i", i);
+ snprintf(plugin_instance, sizeof(plugin_instance), "%i", i);
fh = fopen(filename, "r");
if (fh == NULL) {
diff --git a/src/bind.c b/src/bind.c
index b7308ad83ae7707a9b992aa0a168f1b9ae850593..dc7916a874e1c990d47cb8cb87c716e13235da7e 100644 (file)
--- a/src/bind.c
+++ b/src/bind.c
nsstats_translation_table_length,
plugin_instance};
- ssnprintf(plugin_instance, sizeof(plugin_instance), "%s-zone-%s",
+ snprintf(plugin_instance, sizeof(plugin_instance), "%s-zone-%s",
view->name, zone_name);
if (version == 3) {
list_info_ptr_t list_info = {plugin_instance,
/* type = */ "dns_qtype"};
- ssnprintf(plugin_instance, sizeof(plugin_instance), "%s-qtypes",
+ snprintf(plugin_instance, sizeof(plugin_instance), "%s-qtypes",
view->name);
if (version == 3) {
bind_parse_generic_name_attr_value_list(
resstats_translation_table_length,
plugin_instance};
- ssnprintf(plugin_instance, sizeof(plugin_instance), "%s-resolver_stats",
+ snprintf(plugin_instance, sizeof(plugin_instance), "%s-resolver_stats",
view->name);
if (version == 3) {
bind_parse_generic_name_attr_value_list(
list_info_ptr_t list_info = {plugin_instance,
/* type = */ "dns_qtype_cached"};
- ssnprintf(plugin_instance, sizeof(plugin_instance), "%s-cache_rr_sets",
+ snprintf(plugin_instance, sizeof(plugin_instance), "%s-cache_rr_sets",
view->name);
bind_parse_generic_name_value(/* xpath = */ "cache/rrset",
diff --git a/src/cgroups.c b/src/cgroups.c
index 9cb7cf951317951a9df89ef0ecf0d814a920e1ca..073bf4f3ec061c94d1bf3850191769dc1b919c4b 100644 (file)
--- a/src/cgroups.c
+++ b/src/cgroups.c
if (ignorelist_match(il_cgroup, cgroup_name))
return 0;
- ssnprintf(abs_path, sizeof(abs_path), "%s/%s", dirname, cgroup_name);
+ snprintf(abs_path, sizeof(abs_path), "%s/%s", dirname, cgroup_name);
status = lstat(abs_path, &statbuf);
if (status != 0) {
if (!S_ISDIR(statbuf.st_mode))
return 0;
- ssnprintf(abs_path, sizeof(abs_path), "%s/%s/cpuacct.stat", dirname,
+ snprintf(abs_path, sizeof(abs_path), "%s/%s/cpuacct.stat", dirname,
cgroup_name);
fh = fopen(abs_path, "r");
if (fh == NULL) {
struct stat statbuf;
int status;
- ssnprintf(abs_path, sizeof(abs_path), "%s/%s", dirname, filename);
+ snprintf(abs_path, sizeof(abs_path), "%s/%s", dirname, filename);
status = lstat(abs_path, &statbuf);
if (status != 0) {
diff --git a/src/cpu.c b/src/cpu.c
index a5a136ecf7aedb81dc16f2e61a97be024215efde..307ae499e2baf2e064379c557bfea0ddd7b90b0b 100644 (file)
--- a/src/cpu.c
+++ b/src/cpu.c
sizeof(vl.type_instance));
if (cpu_num >= 0) {
- ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i", cpu_num);
+ snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i", cpu_num);
}
plugin_dispatch_values(&vl);
}
diff --git a/src/cpufreq.c b/src/cpufreq.c
index 608e60e3a4c745377ced242c1e3d7a07910a5db6..f7865b3aa6b80786154e23af5ce1025c473dc22c 100644 (file)
--- a/src/cpufreq.c
+++ b/src/cpufreq.c
num_cpu = 0;
while (1) {
- status = ssnprintf(filename, sizeof(filename),
+ status = snprintf(filename, sizeof(filename),
"/sys/devices/system/cpu/cpu%d/cpufreq/"
"scaling_cur_freq",
num_cpu);
vl.values_len = 1;
sstrncpy(vl.plugin, "cpufreq", sizeof(vl.plugin));
sstrncpy(vl.type, "cpufreq", sizeof(vl.type));
- ssnprintf(vl.type_instance, sizeof(vl.type_instance), "%i", cpu_num);
+ snprintf(vl.type_instance, sizeof(vl.type_instance), "%i", cpu_num);
plugin_dispatch_values(&vl);
}
static int cpufreq_read(void) {
for (int i = 0; i < num_cpu; i++) {
char filename[PATH_MAX];
- ssnprintf(filename, sizeof(filename),
+ snprintf(filename, sizeof(filename),
"/sys/devices/system/cpu/cpu%d/cpufreq/scaling_cur_freq", i);
value_t v;
diff --git a/src/csv.c b/src/csv.c
index e4c84f7fea9b5e4f264650a8a2a1ecebd520fc3d..7d56c89236fb9e92a1f641dca7cbe2c06a83c2eb 100644 (file)
--- a/src/csv.c
+++ b/src/csv.c
memset(buffer, '\0', buffer_len);
- status = ssnprintf(buffer, buffer_len, "%.3f", CDTIME_T_TO_DOUBLE(vl->time));
+ status = snprintf(buffer, buffer_len, "%.3f", CDTIME_T_TO_DOUBLE(vl->time));
if ((status < 1) || (status >= buffer_len))
return -1;
offset = status;
}
if (ds->ds[i].type == DS_TYPE_GAUGE) {
- status = ssnprintf(buffer + offset, buffer_len - offset, ",%lf",
+ status = snprintf(buffer + offset, buffer_len - offset, ",%lf",
vl->values[i].gauge);
} else if (store_rates != 0) {
if (rates == NULL)
return -1;
}
status =
- ssnprintf(buffer + offset, buffer_len - offset, ",%lf", rates[i]);
+ snprintf(buffer + offset, buffer_len - offset, ",%lf", rates[i]);
} else if (ds->ds[i].type == DS_TYPE_COUNTER) {
- status = ssnprintf(buffer + offset, buffer_len - offset, ",%llu",
+ status = snprintf(buffer + offset, buffer_len - offset, ",%llu",
vl->values[i].counter);
} else if (ds->ds[i].type == DS_TYPE_DERIVE) {
- status = ssnprintf(buffer + offset, buffer_len - offset, ",%" PRIi64,
+ status = snprintf(buffer + offset, buffer_len - offset, ",%" PRIi64,
vl->values[i].derive);
} else if (ds->ds[i].type == DS_TYPE_ABSOLUTE) {
- status = ssnprintf(buffer + offset, buffer_len - offset, ",%" PRIu64,
+ status = snprintf(buffer + offset, buffer_len - offset, ",%" PRIu64,
vl->values[i].absolute);
}
diff --git a/src/curl.c b/src/curl.c
index 808f2429ec4f0354f6f9cff31fd4e227d38882ce..f9a94428724503ed9c6ae3760844b49c8ffdecbf 100644 (file)
--- a/src/curl.c
+++ b/src/curl.c
return -1;
}
- ssnprintf(wp->credentials, credentials_size, "%s:%s", wp->user,
+ snprintf(wp->credentials, credentials_size, "%s:%s", wp->user,
(wp->pass == NULL) ? "" : wp->pass);
curl_easy_setopt(wp->curl, CURLOPT_USERPWD, wp->credentials);
#endif
diff --git a/src/curl_json.c b/src/curl_json.c
index 8037742adb939214789d172da67e6981ef5372ab..bf37cf9a49a717ae66d09cea1c31a334896d0060 100644 (file)
--- a/src/curl_json.c
+++ b/src/curl_json.c
db->state[db->depth].index++;
char name[DATA_MAX_NAME_LEN];
- ssnprintf(name, sizeof(name), "%d", db->state[db->depth].index);
+ snprintf(name, sizeof(name), "%d", db->state[db->depth].index);
cj_load_key(db, name);
}
return -1;
}
- ssnprintf(db->credentials, credentials_size, "%s:%s", db->user,
+ snprintf(db->credentials, credentials_size, "%s:%s", db->user,
(db->pass == NULL) ? "" : db->pass);
curl_easy_setopt(db->curl, CURLOPT_USERPWD, db->credentials);
#endif
if (key->instance == NULL) {
int len = 0;
for (int i = 0; i < db->depth; i++)
- len += ssnprintf(vl.type_instance + len, sizeof(vl.type_instance) - len,
+ len += snprintf(vl.type_instance + len, sizeof(vl.type_instance) - len,
i ? "-%s" : "%s", db->state[i + 1].name);
} else
sstrncpy(vl.type_instance, key->instance, sizeof(vl.type_instance));
diff --git a/src/curl_xml.c b/src/curl_xml.c
index a0dca05ea79c26ca9c10889af5529a6bfd44634e..8973a5ba7ea9ca0b7230e709d570b2df28c3ab3f 100644 (file)
--- a/src/curl_xml.c
+++ b/src/curl_xml.c
if (xpath->instance_prefix != NULL) {
if (instance_node != NULL) {
char *node_value = (char *)xmlNodeGetContent(instance_node->nodeTab[0]);
- ssnprintf(vl->type_instance, sizeof(vl->type_instance), "%s%s",
+ snprintf(vl->type_instance, sizeof(vl->type_instance), "%s%s",
xpath->instance_prefix, node_value);
sfree(node_value);
} else
return -1;
}
- ssnprintf(db->credentials, credentials_size, "%s:%s", db->user,
+ snprintf(db->credentials, credentials_size, "%s:%s", db->user,
(db->pass == NULL) ? "" : db->pass);
curl_easy_setopt(db->curl, CURLOPT_USERPWD, db->credentials);
#endif
diff --git a/src/daemon/common.c b/src/daemon/common.c
index d9c83483fd933be389bc841df1801d582a9832c1..31daa37958f46ae22d70f44f68a73ea4fdc1b4d0 100644 (file)
--- a/src/daemon/common.c
+++ b/src/daemon/common.c
return dest;
} /* char *sstrncpy */
-int ssnprintf(char *dest, size_t n, const char *format, ...) {
- int ret = 0;
- va_list ap;
-
- va_start(ap, format);
- ret = vsnprintf(dest, n, format, ap);
- dest[n - 1] = '\0';
- va_end(ap);
-
- return ret;
-} /* int ssnprintf */
-
char *ssnprintf_alloc(char const *format, ...) /* {{{ */
{
char static_buffer[1024] = "";
#else
if (strerror_r(errnum, buf, buflen) != 0) {
- ssnprintf(buf, buflen, "Error #%i; "
+ snprintf(buf, buflen, "Error #%i; "
"Additionally, strerror_r failed.",
errnum);
}
if (kc == NULL)
return -1;
- ssnprintf(ident, sizeof(ident), "%s,%i,%s", module, instance, name);
+ snprintf(ident, sizeof(ident), "%s,%i,%s", module, instance, name);
*ksp_ptr = kstat_lookup(kc, module, instance, name);
if (*ksp_ptr == NULL) {
#define BUFFER_ADD(...) \
do { \
- status = ssnprintf(ret + offset, ret_len - offset, __VA_ARGS__); \
+ status = snprintf(ret + offset, ret_len - offset, __VA_ARGS__); \
if (status < 1) { \
sfree(rates); \
return -1; \
diff --git a/src/daemon/common.h b/src/daemon/common.h
index 8947c575aded79b6027bf96135c441e4149520d0..afd292a3d9b5a31bc91200b59694eb57ab2aac62 100644 (file)
--- a/src/daemon/common.h
+++ b/src/daemon/common.h
char *sstrncpy(char *dest, const char *src, size_t n);
-__attribute__((format(printf, 3, 4))) int ssnprintf(char *dest, size_t n,
- const char *format, ...);
-
__attribute__((format(printf, 1, 2))) char *ssnprintf_alloc(char const *format,
...);
index 5b577d4534679a83470130fe4053f860451f134c..67d800e7105379f54cd9e9c2d3b209217a4c81ee 100644 (file)
--- a/src/daemon/common_test.c
+++ b/src/daemon/common_test.c
return 0;
}
-DEF_TEST(ssnprintf) {
- char buffer[16] = "";
- char *ptr = &buffer[4];
- int status;
-
- buffer[0] = buffer[1] = buffer[2] = buffer[3] = 0xff;
- buffer[12] = buffer[13] = buffer[14] = buffer[15] = 0xff;
-
- status = ssnprintf(ptr, 8, "%i", 1337);
- OK(status == 4);
- EXPECT_EQ_STR("1337", ptr);
-
- status = ssnprintf(ptr, 8, "%s", "collectd");
- OK(status == 8);
- OK(ptr[7] == 0);
- EXPECT_EQ_STR("collect", ptr);
- OK(buffer[3] == buffer[12]);
-
- return 0;
-}
-
DEF_TEST(sstrdup) {
char *ptr;
index 5594bb7ab5b3c808317ae5ab45dfa6dc7be71730..7d8c7e779349ee8f92ceb0d40ecef571799b4aa8 100644 (file)
--- a/src/daemon/configfile.c
+++ b/src/daemon/configfile.c
return global_option_set(ci->key, ci->values[0].value.string, 0);
else if (ci->values[0].type == OCONFIG_TYPE_NUMBER) {
char tmp[128];
- ssnprintf(tmp, sizeof(tmp), "%lf", ci->values[0].value.number);
+ snprintf(tmp, sizeof(tmp), "%lf", ci->values[0].value.number);
return global_option_set(ci->key, tmp, 0);
} else if (ci->values[0].type == OCONFIG_TYPE_BOOLEAN) {
if (ci->values[0].value.boolean)
if (ci->values[i].type == OCONFIG_TYPE_STRING)
status =
- ssnprintf(buffer_ptr, buffer_free, " %s", ci->values[i].value.string);
+ snprintf(buffer_ptr, buffer_free, " %s", ci->values[i].value.string);
else if (ci->values[i].type == OCONFIG_TYPE_NUMBER)
- status = ssnprintf(buffer_ptr, buffer_free, " %lf",
+ status = snprintf(buffer_ptr, buffer_free, " %lf",
ci->values[i].value.number);
else if (ci->values[i].type == OCONFIG_TYPE_BOOLEAN)
- status = ssnprintf(buffer_ptr, buffer_free, " %s",
+ status = snprintf(buffer_ptr, buffer_free, " %s",
ci->values[i].value.boolean ? "true" : "false");
if ((status < 0) || (status >= buffer_free))
if ((de->d_name[0] == '.') || (de->d_name[0] == 0))
continue;
- status = ssnprintf(name, sizeof(name), "%s/%s", dir, de->d_name);
+ status = snprintf(name, sizeof(name), "%s/%s", dir, de->d_name);
if ((status < 0) || ((size_t)status >= sizeof(name))) {
ERROR("configfile: Not including `%s/%s' because its"
" name is too long.",
@@ -1246,7 +1246,7 @@ int cf_util_get_service(const oconfig_item_t *ci, char **ret_string) /* {{{ */
ERROR("cf_util_get_service: Out of memory.");
return -1;
}
- ssnprintf(service, 6, "%i", port);
+ snprintf(service, 6, "%i", port);
sfree(*ret_string);
*ret_string = service;
index 5a2d64729ae953ba753492bc00e082b0a4570df3..77db7969cfe0142d930d57c9a64e71a377c46ef8 100644 (file)
if (ci->values_num == 1) {
sstrncpy(rule->name, ci->values[0].value.string, sizeof(rule->name));
- ssnprintf(rule_name, sizeof(rule_name), "Rule \"%s\"",
+ snprintf(rule_name, sizeof(rule_name), "Rule \"%s\"",
ci->values[0].value.string);
}
diff --git a/src/daemon/meta_data.c b/src/daemon/meta_data.c
index 502ca1086074ff1ab597b75a33a7dd1dec96b36a..ce3e10206de8a065198d9f53f877d8a0e0f26e85 100644 (file)
--- a/src/daemon/meta_data.c
+++ b/src/daemon/meta_data.c
actual = e->value.mv_string;
break;
case MD_TYPE_SIGNED_INT:
- ssnprintf(buffer, sizeof(buffer), "%" PRIi64, e->value.mv_signed_int);
+ snprintf(buffer, sizeof(buffer), "%" PRIi64, e->value.mv_signed_int);
actual = buffer;
break;
case MD_TYPE_UNSIGNED_INT:
- ssnprintf(buffer, sizeof(buffer), "%" PRIu64, e->value.mv_unsigned_int);
+ snprintf(buffer, sizeof(buffer), "%" PRIu64, e->value.mv_unsigned_int);
actual = buffer;
break;
case MD_TYPE_DOUBLE:
- ssnprintf(buffer, sizeof(buffer), GAUGE_FORMAT, e->value.mv_double);
+ snprintf(buffer, sizeof(buffer), GAUGE_FORMAT, e->value.mv_double);
actual = buffer;
break;
case MD_TYPE_BOOLEAN:
diff --git a/src/daemon/plugin.c b/src/daemon/plugin.c
index 3bf183d9c066934ecbfd664ef1c25e75d1c1920c..6ae8ffb81fda247309ac31b3863da9f36de6c0d2 100644 (file)
--- a/src/daemon/plugin.c
+++ b/src/daemon/plugin.c
if (dlh == NULL) {
char errbuf[1024] = "";
- ssnprintf(errbuf, sizeof(errbuf),
+ snprintf(errbuf, sizeof(errbuf),
"dlopen (\"%s\") failed: %s. "
"The most common cause for this problem is "
"missing dependencies. Use ldd(1) to check "
}
char name[THREAD_NAME_MAX];
- ssnprintf(name, sizeof(name), "reader#%zu", read_threads_num);
+ snprintf(name, sizeof(name), "reader#%zu", read_threads_num);
set_thread_name(read_threads[read_threads_num], name);
read_threads_num++;
}
char name[THREAD_NAME_MAX];
- ssnprintf(name, sizeof(name), "writer#%zu", write_threads_num);
+ snprintf(name, sizeof(name), "writer#%zu", write_threads_num);
set_thread_name(write_threads[write_threads_num], name);
write_threads_num++;
/* `cpu' should not match `cpufreq'. To solve this we add `.so' to the
* type when matching the filename */
- status = ssnprintf(typename, sizeof(typename), "%s.so", plugin_name);
+ status = snprintf(typename, sizeof(typename), "%s.so", plugin_name);
if ((status < 0) || ((size_t)status >= sizeof(typename))) {
WARNING("plugin_load: Filename too long: \"%s.so\"", plugin_name);
return -1;
if (strcasecmp(de->d_name, typename))
continue;
- status = ssnprintf(filename, sizeof(filename), "%s/%s", dir, de->d_name);
+ status = snprintf(filename, sizeof(filename), "%s/%s", dir, de->d_name);
if ((status < 0) || ((size_t)status >= sizeof(filename))) {
WARNING("plugin_load: Filename too long: \"%s/%s\"", dir, de->d_name);
continue;
index 815d9697fd3d08d0d7dbc43e8e051af6325739c2..ab440edb6d84fbdb4def2a5c4c66ad9be6e7fd46 100644 (file)
--- a/src/daemon/utils_time.c
+++ b/src/daemon/utils_time.c
size_left -= len;
if (print_nano) {
- if ((len = ssnprintf(pos, size_left, ".%09ld", nsec)) == 0)
+ if ((len = snprintf(pos, size_left, ".%09ld", nsec)) == 0)
return ENOMEM;
pos += len;
size_left -= len;
diff --git a/src/dbi.c b/src/dbi.c
index ac307ff2e01f57f00268c77870c8991b28323892..dd17fac4576e3863d9431d4a1d19f4547244c78c 100644 (file)
--- a/src/dbi.c
+++ b/src/dbi.c
msg = NULL;
status = dbi_conn_error(conn, &msg);
if ((status >= 0) && (msg != NULL))
- ssnprintf(buffer, buffer_size, "%s (status %i)", msg, status);
+ snprintf(buffer, buffer_size, "%s (status %i)", msg, status);
else
- ssnprintf(buffer, buffer_size, "dbi_conn_error failed with status %i",
+ snprintf(buffer, buffer_size, "dbi_conn_error failed with status %i",
status);
return buffer;
long long value;
value = dbi_result_get_longlong_idx(res, index);
- ssnprintf(buffer, buffer_size, "%lli", value);
+ snprintf(buffer, buffer_size, "%lli", value);
} else if (src_type == DBI_TYPE_DECIMAL) {
double value;
value = dbi_result_get_double_idx(res, index);
- ssnprintf(buffer, buffer_size, "%63.15g", value);
+ snprintf(buffer, buffer_size, "%63.15g", value);
} else if (src_type == DBI_TYPE_STRING) {
const char *value;
diff --git a/src/disk.c b/src/disk.c
index 4a217c30ff58dca99bd6c00343a3469df13d7245..fbea0645ea02384afe57fcda97cb8fcb68f2cdd1 100644 (file)
--- a/src/disk.c
+++ b/src/disk.c
sstrncpy(disk_name, props_disk_name_bsd, sizeof(disk_name));
else {
ERROR("disk plugin: can't find bsd disk name.");
- ssnprintf(disk_name, sizeof(disk_name), "%i-%i", disk_major,
+ snprintf(disk_name, sizeof(disk_name), "%i-%i", disk_major,
disk_minor);
}
} else
- ssnprintf(disk_name, sizeof(disk_name), "%i-%i", disk_major, disk_minor);
+ snprintf(disk_name, sizeof(disk_name), "%i-%i", disk_major, disk_minor);
DEBUG("disk plugin: disk_name = \"%s\"", disk_name);
diff --git a/src/dpdkevents.c b/src/dpdkevents.c
index 6be6bc046180f501392fa342e78477a6a5e7b100..3941f1b693df704eae899600dd867e01728b351b 100644 (file)
--- a/src/dpdkevents.c
+++ b/src/dpdkevents.c
if (strcasecmp("PortName", child->key) == 0) {
while (!(ec->config.link_status.enabled_port_mask & (1 << port_num)))
port_num++;
- ssnprintf(ec->config.link_status.port_name[port_num], DATA_MAX_NAME_LEN,
+ snprintf(ec->config.link_status.port_name[port_num], DATA_MAX_NAME_LEN,
"%s", child->values[0].value.string);
DEBUG(DPDK_EVENTS_PLUGIN ": LinkStatus:Port %d Name: %s", port_num,
ec->config.link_status.port_name[port_num]);
(int)child->values[0].value.boolean);
} else if (strcasecmp("LCoreMask", child->key) == 0) {
char lcore_mask[DATA_MAX_NAME_LEN];
- ssnprintf(lcore_mask, sizeof(lcore_mask), "%s",
+ snprintf(lcore_mask, sizeof(lcore_mask), "%s",
child->values[0].value.string);
ec->config.keep_alive.lcore_mask =
str_to_uint128(lcore_mask, strlen(lcore_mask));
ec->config.keep_alive.lcore_mask.high,
ec->config.keep_alive.lcore_mask.low);
} else if (strcasecmp("KeepAliveShmName", child->key) == 0) {
- ssnprintf(ec->config.keep_alive.shm_name,
+ snprintf(ec->config.keep_alive.shm_name,
sizeof(ec->config.keep_alive.shm_name), "%s",
child->values[0].value.string);
DEBUG(DPDK_EVENTS_PLUGIN ": KeepAlive:KeepAliveShmName %s",
char dev_name[DATA_MAX_NAME_LEN];
if (ec->config.link_status.port_name[i][0] != 0) {
- ssnprintf(dev_name, sizeof(dev_name), "%s",
+ snprintf(dev_name, sizeof(dev_name), "%s",
ec->config.link_status.port_name[i]);
} else {
- ssnprintf(dev_name, sizeof(dev_name), "port.%d", i);
+ snprintf(dev_name, sizeof(dev_name), "port.%d", i);
}
if (ec->config.link_status.notify) {
int sev = ec->link_info[i].link_status ? NOTIF_OKAY : NOTIF_WARNING;
char msg[DATA_MAX_NAME_LEN];
- ssnprintf(msg, sizeof(msg), "Link Status: %s",
+ snprintf(msg, sizeof(msg), "Link Status: %s",
ec->link_info[i].link_status ? "UP" : "DOWN");
dpdk_events_notification_dispatch(sev, dev_name,
ec->link_info[i].read_time, msg);
}
char core_name[DATA_MAX_NAME_LEN];
- ssnprintf(core_name, sizeof(core_name), "lcore%u", i);
+ snprintf(core_name, sizeof(core_name), "lcore%u", i);
if (!ec->config.keep_alive.send_updated ||
(ec->core_info[i].lcore_state !=
switch (ec->config.keep_alive.shm->core_state[i]) {
case RTE_KA_STATE_ALIVE:
sev = NOTIF_OKAY;
- ssnprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: ALIVE", i);
+ snprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: ALIVE", i);
break;
case RTE_KA_STATE_MISSING:
- ssnprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: MISSING", i);
+ snprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: MISSING", i);
sev = NOTIF_WARNING;
break;
case RTE_KA_STATE_DEAD:
- ssnprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: DEAD", i);
+ snprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: DEAD", i);
sev = NOTIF_FAILURE;
break;
case RTE_KA_STATE_UNUSED:
- ssnprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: UNUSED", i);
+ snprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: UNUSED", i);
sev = NOTIF_OKAY;
break;
case RTE_KA_STATE_GONE:
- ssnprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: GONE", i);
+ snprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: GONE", i);
sev = NOTIF_FAILURE;
break;
case RTE_KA_STATE_DOZING:
- ssnprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: DOZING", i);
+ snprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: DOZING", i);
sev = NOTIF_OKAY;
break;
case RTE_KA_STATE_SLEEP:
- ssnprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: SLEEP", i);
+ snprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: SLEEP", i);
sev = NOTIF_OKAY;
break;
default:
- ssnprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: UNKNOWN", i);
+ snprintf(msg, sizeof(msg), "lcore %u Keep Alive Status: UNKNOWN", i);
sev = NOTIF_FAILURE;
}
diff --git a/src/dpdkstat.c b/src/dpdkstat.c
index cc525e82c7b08d1bb7dae201144be0ddce92172b..debcfef4c0facdec71c0332a6e96aa2ff1dde339 100644 (file)
--- a/src/dpdkstat.c
+++ b/src/dpdkstat.c
char dev_name[64];
if (ctx->config.port_name[i][0] != 0) {
- ssnprintf(dev_name, sizeof(dev_name), "%s", ctx->config.port_name[i]);
+ snprintf(dev_name, sizeof(dev_name), "%s", ctx->config.port_name[i]);
} else {
- ssnprintf(dev_name, sizeof(dev_name), "port.%d", i);
+ snprintf(dev_name, sizeof(dev_name), "port.%d", i);
}
DEBUG(" === Dispatch stats for port %d (name=%s; stats_count=%d)", i,
diff --git a/src/drbd.c b/src/drbd.c
index 97a4f03247bad49e8bc664230865323086caae1c..5a0eac3098a3c696c33124b55cb2ef2e93f7221c 100644 (file)
--- a/src/drbd.c
+++ b/src/drbd.c
return EINVAL;
}
- ssnprintf(plugin_instance, sizeof(plugin_instance), "r%ld", resource);
+ snprintf(plugin_instance, sizeof(plugin_instance), "r%ld", resource);
for (size_t i = 0; i < drbd_names_num; i++) {
char *data;
diff --git a/src/exec.c b/src/exec.c
index 3d12a2de2037b83c4cc4a5e8e3b392cfb62c43ee..87e36e65f4444871c6ec8e8218d65796294f1f1c 100644 (file)
--- a/src/exec.c
+++ b/src/exec.c
pl->argv[i] = strdup(ci->values[i + 1].value.string);
} else {
if (ci->values[i + 1].type == OCONFIG_TYPE_NUMBER) {
- ssnprintf(buffer, sizeof(buffer), "%lf",
+ snprintf(buffer, sizeof(buffer), "%lf",
ci->values[i + 1].value.number);
} else {
if (ci->values[i + 1].value.boolean)
char buffer[1024];
#ifdef HAVE_SETENV
- ssnprintf(buffer, sizeof(buffer), "%.3f",
+ snprintf(buffer, sizeof(buffer), "%.3f",
CDTIME_T_TO_DOUBLE(plugin_get_interval()));
setenv("COLLECTD_INTERVAL", buffer, /* overwrite = */ 1);
sstrncpy(buffer, hostname_g, sizeof(buffer));
setenv("COLLECTD_HOSTNAME", buffer, /* overwrite = */ 1);
#else
- ssnprintf(buffer, sizeof(buffer), "COLLECTD_INTERVAL=%.3f",
+ snprintf(buffer, sizeof(buffer), "COLLECTD_INTERVAL=%.3f",
CDTIME_T_TO_DOUBLE(plugin_get_interval()));
putenv(buffer);
- ssnprintf(buffer, sizeof(buffer), "COLLECTD_HOSTNAME=%s", hostname_g);
+ snprintf(buffer, sizeof(buffer), "COLLECTD_HOSTNAME=%s", hostname_g);
putenv(buffer);
#endif
} /* }}} void set_environment */
diff --git a/src/filecount.c b/src/filecount.c
index 7eb510475eaab13dba2cf0dc90850dbc1d9ba5ed..a2ec8e82884e8888bd6eb9f57847b3eec3c04adb 100644 (file)
--- a/src/filecount.c
+++ b/src/filecount.c
if (dir == NULL)
return -1;
- ssnprintf(abs_path, sizeof(abs_path), "%s/%s", dirname, filename);
+ snprintf(abs_path, sizeof(abs_path), "%s/%s", dirname, filename);
status = lstat(abs_path, &statbuf);
if (status != 0) {
diff --git a/src/gmond.c b/src/gmond.c
index c6804276be4ca7497b88fe621e48cd08c4e12265..75643c44e6f9abceb137ced0305aa8a0ae7ce69e 100644 (file)
--- a/src/gmond.c
+++ b/src/gmond.c
if (staging_tree == NULL)
return NULL;
- ssnprintf(key, sizeof(key), "%s/%s/%s", host, type,
+ snprintf(key, sizeof(key), "%s/%s/%s", host, type,
(type_instance != NULL) ? type_instance : "");
se = NULL;
diff --git a/src/hddtemp.c b/src/hddtemp.c
index 3af9c0fa640433ff89cd3cc8e6cfb98e7372da5a..a7eaf3699f139ea7df470b01d42376f7433f255d 100644 (file)
--- a/src/hddtemp.c
+++ b/src/hddtemp.c
} else if (strcasecmp(key, "Port") == 0) {
int port = (int)(atof(value));
if ((port > 0) && (port <= 65535))
- ssnprintf(hddtemp_port, sizeof(hddtemp_port), "%i", port);
+ snprintf(hddtemp_port, sizeof(hddtemp_port), "%i", port);
else
sstrncpy(hddtemp_port, value, sizeof(hddtemp_port));
} else {
diff --git a/src/hugepages.c b/src/hugepages.c
index 871e625f1712a78a475bc8abaab5a24d8e7702f1..8af7f50ede5f5d2964413509837a902f548089a9 100644 (file)
--- a/src/hugepages.c
+++ b/src/hugepages.c
sstrncpy(vl.plugin, g_plugin_name, sizeof(vl.plugin));
if (info->node) {
- ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s-%zuKb",
+ snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s-%zuKb",
info->node, info->page_size_kb);
} else {
- ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%zuKb",
+ snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%zuKb",
info->page_size_kb);
}
struct entry_info *info = e_info;
double value;
- ssnprintf(path2, sizeof(path2), "%s/%s", path, entry);
+ snprintf(path2, sizeof(path2), "%s/%s", path, entry);
FILE *fh = fopen(path2, "rt");
if (fh == NULL) {
}
/* /sys/devices/system/node/node?/hugepages/ */
- ssnprintf(path2, sizeof(path2), "%s/%s", path, result->d_name);
+ snprintf(path2, sizeof(path2), "%s/%s", path, result->d_name);
walk_directory(path2, read_hugepage_entry,
&(struct entry_info){
continue;
}
- ssnprintf(path, sizeof(path), sys_node_hugepages, result->d_name);
+ snprintf(path, sizeof(path), sys_node_hugepages, result->d_name);
read_syshugepages(path, result->d_name);
errno = 0;
}
diff --git a/src/intel_rdt.c b/src/intel_rdt.c
index 7966daa5e304ebf7d40a12125ba2ffdd34e78c7f..5eabdb301ed9b34fd5cb8ec0cb27db8e083c79d2 100644 (file)
--- a/src/intel_rdt.c
+++ b/src/intel_rdt.c
char desc[DATA_MAX_NAME_LEN];
uint64_t core = i;
- ssnprintf(desc, sizeof(desc), "%d", g_rdt->pqos_cpu->cores[i].lcore);
+ snprintf(desc, sizeof(desc), "%d", g_rdt->pqos_cpu->cores[i].lcore);
/* set core group info */
ret = cgroup_set(&g_rdt->cgroups[i], desc, &core, 1);
diff --git a/src/interface.c b/src/interface.c
index 78a0d694fe18efdd0a5ac4640d157d745062abaf..2ff7db2a1690dd3ffa1da8ac41a99cd474430c8e 100644 (file)
--- a/src/interface.c
+++ b/src/interface.c
continue;
if (unique_name)
- ssnprintf(iname, sizeof(iname), "%s_%d_%s", ksp[i]->ks_module,
+ snprintf(iname, sizeof(iname), "%s_%d_%s", ksp[i]->ks_module,
ksp[i]->ks_instance, ksp[i]->ks_name);
else
sstrncpy(iname, ksp[i]->ks_name, sizeof(iname));
diff --git a/src/ipmi.c b/src/ipmi.c
index 98e77bfe17472a4743098b509d54b7b587e065ad..ff79049b0693183484a8e968d6d44bcf4ee9a955 100644 (file)
--- a/src/ipmi.c
+++ b/src/ipmi.c
}
if (errbuf[0] == 0) {
- ssnprintf(errbuf, sizeof(errbuf), "Unknown error %#x", status);
+ snprintf(errbuf, sizeof(errbuf), "Unknown error %#x", status);
}
errbuf[sizeof(errbuf) - 1] = 0;
sstrncpy(n.type_instance, list_item->sensor_name,
sizeof(n.type_instance));
sstrncpy(n.type, list_item->sensor_type, sizeof(n.type));
- ssnprintf(n.message, sizeof(n.message), "sensor %s not present",
+ snprintf(n.message, sizeof(n.message), "sensor %s not present",
list_item->sensor_name);
plugin_dispatch_notification(&n);
sstrncpy(n.type_instance, list_item->sensor_name,
sizeof(n.type_instance));
sstrncpy(n.type, list_item->sensor_type, sizeof(n.type));
- ssnprintf(n.message, sizeof(n.message), "sensor %s present",
+ snprintf(n.message, sizeof(n.message), "sensor %s present",
list_item->sensor_name);
plugin_dispatch_notification(&n);
if (entity_id_string == NULL)
sstrncpy(sensor_name, buffer, sizeof(sensor_name));
else
- ssnprintf(sensor_name, sizeof(sensor_name), "%s %s", buffer,
+ snprintf(sensor_name, sizeof(sensor_name), "%s %s", buffer,
entity_id_string);
sstrncpy(buffer, sensor_name, sizeof(buffer));
sensor_id_ptr = strstr(buffer, "(");
if (sensor_id_ptr != NULL) {
/* `sensor_id_ptr' now points to "(123)". */
- ssnprintf(sensor_name, sizeof(sensor_name), "%s %s", sensor_name_ptr,
+ snprintf(sensor_name, sizeof(sensor_name), "%s %s", sensor_name_ptr,
sensor_id_ptr);
}
/* else: don't touch sensor_name. */
sstrncpy(n.host, hostname_g, sizeof(n.host));
sstrncpy(n.type_instance, list_item->sensor_name, sizeof(n.type_instance));
sstrncpy(n.type, list_item->sensor_type, sizeof(n.type));
- ssnprintf(n.message, sizeof(n.message), "sensor %s added",
+ snprintf(n.message, sizeof(n.message), "sensor %s added",
list_item->sensor_name);
plugin_dispatch_notification(&n);
sstrncpy(n.host, hostname_g, sizeof(n.host));
sstrncpy(n.type_instance, list_item->sensor_name, sizeof(n.type_instance));
sstrncpy(n.type, list_item->sensor_type, sizeof(n.type));
- ssnprintf(n.message, sizeof(n.message), "sensor %s removed",
+ snprintf(n.message, sizeof(n.message), "sensor %s removed",
list_item->sensor_name);
plugin_dispatch_notification(&n);
diff --git a/src/iptables.c b/src/iptables.c
index 1d127bf7c6a2b55872489bcabdfaa84c79ccc535..8969cf74a60d88ed09774f2e9e6057586c39b02b 100644 (file)
--- a/src/iptables.c
+++ b/src/iptables.c
sstrncpy(vl.plugin, "ip6tables", sizeof(vl.plugin));
- status = ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s-%s",
+ status = snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s-%s",
chain->table, chain->chain);
if ((status < 1) || ((unsigned int)status >= sizeof(vl.plugin_instance)))
return 0;
sstrncpy(vl.type_instance, chain->name, sizeof(vl.type_instance));
} else {
if (chain->rule_type == RTYPE_NUM)
- ssnprintf(vl.type_instance, sizeof(vl.type_instance), "%i",
+ snprintf(vl.type_instance, sizeof(vl.type_instance), "%i",
chain->rule.num);
else
sstrncpy(vl.type_instance, (char *)match->data, sizeof(vl.type_instance));
sstrncpy(vl.plugin, "iptables", sizeof(vl.plugin));
- status = ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s-%s",
+ status = snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s-%s",
chain->table, chain->chain);
if ((status < 1) || ((unsigned int)status >= sizeof(vl.plugin_instance)))
return 0;
sstrncpy(vl.type_instance, chain->name, sizeof(vl.type_instance));
} else {
if (chain->rule_type == RTYPE_NUM)
- ssnprintf(vl.type_instance, sizeof(vl.type_instance), "%i",
+ snprintf(vl.type_instance, sizeof(vl.type_instance), "%i",
chain->rule.num);
else
sstrncpy(vl.type_instance, (char *)match->data, sizeof(vl.type_instance));
diff --git a/src/ipvs.c b/src/ipvs.c
index da67970d21dcb507441a1f35b3a866ede67f9361..f747cb0765a398117494de26886e54b8fb64f6d7 100644 (file)
--- a/src/ipvs.c
+++ b/src/ipvs.c
struct in_addr addr = {.s_addr = se->addr};
int len =
- ssnprintf(pi, size, "%s_%s%u", inet_ntoa(addr),
+ snprintf(pi, size, "%s_%s%u", inet_ntoa(addr),
(se->protocol == IPPROTO_TCP) ? "TCP" : "UDP", ntohs(se->port));
if ((len < 0) || (size <= ((size_t)len))) {
struct in_addr addr = {.s_addr = de->addr};
- int len = ssnprintf(ti, size, "%s_%u", inet_ntoa(addr), ntohs(de->port));
+ int len = snprintf(ti, size, "%s_%u", inet_ntoa(addr), ntohs(de->port));
if ((len < 0) || (size <= ((size_t)len))) {
log_err("type instance truncated: %s", ti);
diff --git a/src/logfile.c b/src/logfile.c
index e5807f1b4ba5ab6b9a9828cd1929b4547a41dd89..d7d011c1f5cfde4ed94db5a3780815255b79692f 100644 (file)
--- a/src/logfile.c
+++ b/src/logfile.c
int buf_len = sizeof(buf);
int status;
- status = ssnprintf(
+ status = snprintf(
buf_ptr, buf_len, "Notification: severity = %s",
(n->severity == NOTIF_FAILURE)
? "FAILURE"
#define APPEND(bufptr, buflen, key, value) \
if ((buflen > 0) && (strlen(value) > 0)) { \
- status = ssnprintf(bufptr, buflen, ", %s = %s", key, value); \
+ status = snprintf(bufptr, buflen, ", %s = %s", key, value); \
if (status > 0) { \
bufptr += status; \
buflen -= status; \
diff --git a/src/lpar.c b/src/lpar.c
index a0dde32c9ace7b88141fcfe1e0db175b29173d12..3ecf0495fada9167ee899d09d4692bd14bb71719 100644 (file)
--- a/src/lpar.c
+++ b/src/lpar.c
if (pool_busy_cpus < 0.0)
pool_busy_cpus = 0.0;
- ssnprintf(typinst, sizeof(typinst), "pool-%X-busy", lparstats.pool_id);
+ snprintf(typinst, sizeof(typinst), "pool-%X-busy", lparstats.pool_id);
lpar_submit(typinst, pool_busy_cpus);
- ssnprintf(typinst, sizeof(typinst), "pool-%X-idle", lparstats.pool_id);
+ snprintf(typinst, sizeof(typinst), "pool-%X-idle", lparstats.pool_id);
lpar_submit(typinst, pool_idle_cpus);
}
diff --git a/src/lua.c b/src/lua.c
index aeaeff2465fda0134ecfddf506cdf430fbf00196..ffed47031af681fcc4b023b495bdd95d7040c62d 100644 (file)
--- a/src/lua.c
+++ b/src/lua.c
luaL_checktype(L, 1, LUA_TFUNCTION);
char function_name[DATA_MAX_NAME_LEN];
- ssnprintf(function_name, sizeof(function_name), "lua/%s", lua_tostring(L, 1));
+ snprintf(function_name, sizeof(function_name), "lua/%s", lua_tostring(L, 1));
int callback_id = clua_store_callback(L, 1);
if (callback_id < 0)
luaL_checktype(L, 1, LUA_TFUNCTION);
char function_name[DATA_MAX_NAME_LEN] = "";
- ssnprintf(function_name, sizeof(function_name), "lua/%s", lua_tostring(L, 1));
+ snprintf(function_name, sizeof(function_name), "lua/%s", lua_tostring(L, 1));
int callback_id = clua_store_callback(L, 1);
if (callback_id < 0)
if (base_path[0] == '\0')
sstrncpy(abs_path, rel_path, sizeof(abs_path));
else
- ssnprintf(abs_path, sizeof(abs_path), "%s/%s", base_path, rel_path);
+ snprintf(abs_path, sizeof(abs_path), "%s/%s", base_path, rel_path);
DEBUG("Lua plugin: abs_path = \"%s\";", abs_path);
diff --git a/src/lvm.c b/src/lvm.c
index c3214b07ad15c3fd315be9bbab377afb9a939a15..11232651eff4b33976b7a18ead8dc0dbfa8fd65b 100644 (file)
--- a/src/lvm.c
+++ b/src/lvm.c
return;
used_bytes = lv_size * (used_percent_unscaled * PERCENT_SCALE_FACTOR);
- ssnprintf(plugin_instance, sizeof(plugin_instance), "%s-%s", vg_name,
+ snprintf(plugin_instance, sizeof(plugin_instance), "%s-%s", vg_name,
lv_name);
lvm_submit(plugin_instance, "used", used_bytes);
lvm_submit(plugin_instance, "free", lv_size - used_bytes);
diff --git a/src/madwifi.c b/src/madwifi.c
index 5a915b625e18cf3150697d068a7dd358fd945fc8..aa1f0955da9df08231abd6141c75e60500468011 100644 (file)
--- a/src/madwifi.c
+++ b/src/madwifi.c
sstrncpy(vl.type, type, sizeof(vl.type));
if ((ti1 != NULL) && (ti2 != NULL))
- ssnprintf(vl.type_instance, sizeof(vl.type_instance), "%s-%s", ti1, ti2);
+ snprintf(vl.type_instance, sizeof(vl.type_instance), "%s-%s", ti1, ti2);
else if ((ti1 != NULL) && (ti2 == NULL))
sstrncpy(vl.type_instance, ti1, sizeof(vl.type_instance));
if (vals[i] == 0)
continue;
- ssnprintf(ti2, sizeof(ti2), "%i", i);
+ snprintf(ti2, sizeof(ti2), "%i", i);
submit_derive(dev, "ath_stat", name, ti2, (derive_t)vals[i]);
}
}
static inline void macaddr_to_str(char *buf, size_t bufsize,
const uint8_t mac[IEEE80211_ADDR_LEN]) {
- ssnprintf(buf, bufsize, "%02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1],
+ snprintf(buf, bufsize, "%02x:%02x:%02x:%02x:%02x:%02x", mac[0], mac[1],
mac[2], mac[3], mac[4], mac[5]);
}
if (dev[0] == '.')
return 0;
- ssnprintf(buf, sizeof(buf), "/sys/class/net/%s/device/driver", dev);
+ snprintf(buf, sizeof(buf), "/sys/class/net/%s/device/driver", dev);
buf[sizeof(buf) - 1] = '\0';
i = readlink(buf, buf2, sizeof(buf2) - 1);
diff --git a/src/match_regex.c b/src/match_regex.c
index 6b45f6c961b7d4fae42a38ccfc624420d6b45fbc..dd4018b03b4ec0e07b4efb5ce6871210511d58dc 100644 (file)
--- a/src/match_regex.c
+++ b/src/match_regex.c
llist_append(*meta, entry);
}
- ssnprintf(buffer, sizeof(buffer), "%s `%s'", ci->key, meta_key);
+ snprintf(buffer, sizeof(buffer), "%s `%s'", ci->key, meta_key);
/* Can't pass &entry->value into mr_add_regex, so copy in/out. */
re_head = entry->value;
status = mr_add_regex(&re_head, ci->values[1].value.string, buffer);
diff --git a/src/mcelog.c b/src/mcelog.c
index fad18d50e4c554f974546ca4d769aef36e653d3f..14054bdf14a40e0293168996cc3593f6198b451b 100644 (file)
--- a/src/mcelog.c
+++ b/src/mcelog.c
.type_instance = "corrected_memory_errors"};
if (mr->dimm_name[0] != '\0')
- ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s_%s",
+ snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s_%s",
mr->location, mr->dimm_name);
else
sstrncpy(vl.plugin_instance, mr->location, sizeof(vl.plugin_instance));
plugin_dispatch_values(&vl);
- ssnprintf(vl.type_instance, sizeof(vl.type_instance),
+ snprintf(vl.type_instance, sizeof(vl.type_instance),
"corrected_memory_errors_in_%s", mr->corrected_err_timed_period);
vl.values = &(value_t){.derive = (derive_t)mr->corrected_err_timed};
plugin_dispatch_values(&vl);
vl.values = &(value_t){.derive = (derive_t)mr->uncorrected_err_total};
plugin_dispatch_values(&vl);
- ssnprintf(vl.type_instance, sizeof(vl.type_instance),
+ snprintf(vl.type_instance, sizeof(vl.type_instance),
"uncorrected_memory_errors_in_%s",
mr->uncorrected_err_timed_period);
vl.values = &(value_t){.derive = (derive_t)mr->uncorrected_err_timed};
diff --git a/src/md.c b/src/md.c
index 98cef1d4da3b772d907802ca88be1736c931978e..016e6b0cbe5ef5370465f392453413b50f42054a 100644 (file)
--- a/src/md.c
+++ b/src/md.c
vl.values = &(value_t){.gauge = value};
vl.values_len = 1;
sstrncpy(vl.plugin, "md", sizeof(vl.plugin));
- ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i", minor);
+ snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i", minor);
sstrncpy(vl.type, "md_disks", sizeof(vl.type));
sstrncpy(vl.type_instance, type_instance, sizeof(vl.type_instance));
* major/minor, but that again can be tricky if the filesystem
* with the device file is mounted using the "nodev" option.
*/
- ssnprintf(path, sizeof(path), "%s/%s", DEV_DIR, name);
+ snprintf(path, sizeof(path), "%s/%s", DEV_DIR, name);
md_process(minor, path);
}
diff --git a/src/memcached.c b/src/memcached.c
index 5fc17df3c4d0f0467db48367680ad7ec78a0791b..eef453e1b90189e7c3a08ef78c7db4e7d31d2dcc 100644 (file)
--- a/src/memcached.c
+++ b/src/memcached.c
char callback_name[3 * DATA_MAX_NAME_LEN];
int status;
- ssnprintf(callback_name, sizeof(callback_name), "memcached/%s",
+ snprintf(callback_name, sizeof(callback_name), "memcached/%s",
(st->name != NULL) ? st->name : "__legacy__");
/* If no <Address> used then:
diff --git a/src/mic.c b/src/mic.c
index 90a61789f214fb9801828af8e1f90976fddd6aa2..166e598b650050f1579f55bc6361974cf821688e 100644 (file)
--- a/src/mic.c
+++ b/src/mic.c
vl.values_len = 1;
strncpy(vl.plugin, "mic", sizeof(vl.plugin));
- ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i", micnumber);
+ snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i", micnumber);
strncpy(vl.type, "memory", sizeof(vl.type));
strncpy(vl.type_instance, type_instance, sizeof(vl.type_instance));
strncpy(vl.host, hostname_g, sizeof(vl.host));
strncpy(vl.plugin, "mic", sizeof(vl.plugin));
- ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i", micnumber);
+ snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i", micnumber);
strncpy(vl.type, "temperature", sizeof(vl.type));
strncpy(vl.type_instance, type, sizeof(vl.type_instance));
strncpy(vl.host, hostname_g, sizeof(vl.host));
strncpy(vl.plugin, "mic", sizeof(vl.plugin));
if (core < 0) /* global aggregation */
- ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i", micnumber);
+ snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i", micnumber);
else /* per-core statistics */
- ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i-cpu-%i",
+ snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i-cpu-%i",
micnumber, core);
strncpy(vl.type, "cpu", sizeof(vl.type));
strncpy(vl.type_instance, type_instance, sizeof(vl.type_instance));
strncpy(vl.host, hostname_g, sizeof(vl.host));
strncpy(vl.plugin, "mic", sizeof(vl.plugin));
- ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i", micnumber);
+ snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i", micnumber);
strncpy(vl.type, type, sizeof(vl.type));
strncpy(vl.type_instance, type_instance, sizeof(vl.type_instance));
diff --git a/src/modbus.c b/src/modbus.c
index f45fe21c3f4e6445e91cc5d28432534f235a479d..715724d1d44c8eef2dce93aa533aa91b6fff62ac 100644 (file)
--- a/src/modbus.c
+++ b/src/modbus.c
host->interval = plugin_get_interval();
if (slave->instance[0] == 0)
- ssnprintf(slave->instance, sizeof(slave->instance), "slave_%i", slave->id);
+ snprintf(slave->instance, sizeof(slave->instance), "slave_%i", slave->id);
vl.values = &value;
vl.values_len = 1;
if (status == 0) {
char name[1024];
- ssnprintf(name, sizeof(name), "modbus-%s", host->host);
+ snprintf(name, sizeof(name), "modbus-%s", host->host);
plugin_register_complex_read(/* group = */ NULL, name,
/* callback = */ mb_read,
diff --git a/src/mqtt.c b/src/mqtt.c
index 36e657786fb59818e5ebc751c36395551d73b32a..94686b032d511f3729eb940fcd932b5d65e22a7f 100644 (file)
--- a/src/mqtt.c
+++ b/src/mqtt.c
if (status != 0)
return status;
- status = ssnprintf(buf, buf_len, "%s/%s", conf->topic_prefix, name);
+ status = snprintf(buf, buf_len, "%s/%s", conf->topic_prefix, name);
if ((status < 0) || (((size_t)status) >= buf_len))
return ENOMEM;
ERROR("mqtt plugin: Unknown config option: %s", child->key);
}
- ssnprintf(cb_name, sizeof(cb_name), "mqtt/%s", conf->name);
+ snprintf(cb_name, sizeof(cb_name), "mqtt/%s", conf->name);
plugin_register_write(cb_name, mqtt_write, &(user_data_t){
.data = conf,
});
diff --git a/src/mysql.c b/src/mysql.c
index b6edce0d36115192752fe2a12bb9b4f3f864e27f..cfc9b59f7a7f53825a883abac0ab5e5be8cd6927 100644 (file)
--- a/src/mysql.c
+++ b/src/mysql.c
(db->database != NULL) ? db->database : "<default>");
if (db->instance != NULL)
- ssnprintf(cb_name, sizeof(cb_name), "mysql-%s", db->instance);
+ snprintf(cb_name, sizeof(cb_name), "mysql-%s", db->instance);
else
sstrncpy(cb_name, "mysql", sizeof(cb_name));
if (((io == NULL) || (strcasecmp(io, "yes") != 0)) &&
(db->slave_io_running)) {
n.severity = NOTIF_WARNING;
- ssnprintf(n.message, sizeof(n.message),
+ snprintf(n.message, sizeof(n.message),
"slave I/O thread not started or not connected to master");
plugin_dispatch_notification(&n);
db->slave_io_running = 0;
} else if (((io != NULL) && (strcasecmp(io, "yes") == 0)) &&
(!db->slave_io_running)) {
n.severity = NOTIF_OKAY;
- ssnprintf(n.message, sizeof(n.message),
+ snprintf(n.message, sizeof(n.message),
"slave I/O thread started and connected to master");
plugin_dispatch_notification(&n);
db->slave_io_running = 1;
if (((sql == NULL) || (strcasecmp(sql, "yes") != 0)) &&
(db->slave_sql_running)) {
n.severity = NOTIF_WARNING;
- ssnprintf(n.message, sizeof(n.message), "slave SQL thread not started");
+ snprintf(n.message, sizeof(n.message), "slave SQL thread not started");
plugin_dispatch_notification(&n);
db->slave_sql_running = 0;
} else if (((sql != NULL) && (strcasecmp(sql, "yes") == 0)) &&
(!db->slave_sql_running)) {
n.severity = NOTIF_OKAY;
- ssnprintf(n.message, sizeof(n.message), "slave SQL thread started");
+ snprintf(n.message, sizeof(n.message), "slave SQL thread started");
plugin_dispatch_notification(&n);
db->slave_sql_running = 1;
}
diff --git a/src/netapp.c b/src/netapp.c
index 701ac2f72f0864a69c0a0c6de117d4222f28d927..0b80f76de6da377e08f91194ea4429414c92cb3b 100644 (file)
--- a/src/netapp.c
+++ b/src/netapp.c
if ((hostname == NULL) || (old_data == NULL) || (new_data == NULL))
return -1;
- ssnprintf(plugin_instance, sizeof(plugin_instance), "volume-%s",
+ snprintf(plugin_instance, sizeof(plugin_instance), "volume-%s",
old_data->name);
/* Check for and submit disk-octet values */
uint64_t snap_reserve_free = v->snap_reserved;
uint64_t snap_norm_used = v->snap_used;
- ssnprintf(plugin_instance, sizeof(plugin_instance), "volume-%s", v->name);
+ snprintf(plugin_instance, sizeof(plugin_instance), "volume-%s", v->name);
if (HAS_ALL_FLAGS(v->flags, HAVE_VOLUME_USAGE_SNAP_USED |
HAVE_VOLUME_USAGE_SNAP_RSVD)) {
if ((v->flags & IS_VOLUME_USAGE_OFFLINE) != 0) {
n.severity = NOTIF_OKAY;
- ssnprintf(n.message, sizeof(n.message), "Volume %s is now online.",
+ snprintf(n.message, sizeof(n.message), "Volume %s is now online.",
v->name);
v->flags &= ~IS_VOLUME_USAGE_OFFLINE;
} else {
n.severity = NOTIF_WARNING;
- ssnprintf(n.message, sizeof(n.message), "Volume %s is now offline.",
+ snprintf(n.message, sizeof(n.message), "Volume %s is now offline.",
v->name);
v->flags |= IS_VOLUME_USAGE_OFFLINE;
}
if (volume_name == NULL)
continue;
- ssnprintf(plugin_instance, sizeof(plugin_instance), "quota-%s-%s",
+ snprintf(plugin_instance, sizeof(plugin_instance), "quota-%s-%s",
volume_name, tree_name);
value = na_child_get_uint64(elem_quota, "disk-used", UINT64_MAX);
continue;
/* possible TODO: make plugin instance configurable */
- ssnprintf(plugin_instance, sizeof(plugin_instance), "snapvault-%s",
+ snprintf(plugin_instance, sizeof(plugin_instance), "snapvault-%s",
dest_path);
submit_double(hostname, plugin_instance, /* type = */ "delay", NULL,
(double)value, /* timestamp = */ 0, interval);
char cb_name[256];
if (host->vfiler)
- ssnprintf(cb_name, sizeof(cb_name), "netapp-%s-%s", host->name,
+ snprintf(cb_name, sizeof(cb_name), "netapp-%s-%s", host->name,
host->vfiler);
else
- ssnprintf(cb_name, sizeof(cb_name), "netapp-%s", host->name);
+ snprintf(cb_name, sizeof(cb_name), "netapp-%s", host->name);
plugin_register_complex_read(
/* group = */ NULL, cb_name,
diff --git a/src/netlink.c b/src/netlink.c
index 3cc1084bba2c8084a61cb14eef6e3f4a21fc72e3..9d84956d66f8274cb82e656216cb6fc23155056d 100644 (file)
--- a/src/netlink.c
+++ b/src/netlink.c
if (strcmp(tc_type, "filter") == 0)
numberic_id = tm->tcm_parent;
- ssnprintf(tc_inst, sizeof(tc_inst), "%s-%x:%x", kind, numberic_id >> 16,
+ snprintf(tc_inst, sizeof(tc_inst), "%s-%x:%x", kind, numberic_id >> 16,
numberic_id & 0x0000FFFF);
}
stats_submitted = 1;
- ssnprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type,
+ snprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type,
tc_inst);
if (q_stats.bs != NULL) {
if (!stats_submitted && ts != NULL) {
char type_instance[DATA_MAX_NAME_LEN];
- ssnprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type,
+ snprintf(type_instance, sizeof(type_instance), "%s-%s", tc_type,
tc_inst);
submit_one(dev, "ipt_bytes", type_instance, ts->bytes);
diff --git a/src/nfs.c b/src/nfs.c
index 6290613323fdfede22acf8ce39bd685b520cb5eb..6537fd14e44c9565510985626479d87b200999b2 100644 (file)
--- a/src/nfs.c
+++ b/src/nfs.c
char plugin_instance[DATA_MAX_NAME_LEN];
value_t values[fields_num];
- ssnprintf(plugin_instance, sizeof(plugin_instance), "v%i%s", nfs_version,
+ snprintf(plugin_instance, sizeof(plugin_instance), "v%i%s", nfs_version,
instance);
for (size_t i = 0; i < fields_num; i++)
if (ksp == NULL)
return EINVAL;
- ssnprintf(plugin_instance, sizeof(plugin_instance), "v%i%s", nfs_version,
+ snprintf(plugin_instance, sizeof(plugin_instance), "v%i%s", nfs_version,
inst);
kstat_read(kc, ksp, NULL);
diff --git a/src/nginx.c b/src/nginx.c
index 0f1da0aebdfeb522f15182b91255e5b2ebef12ff..f212461be94799b48c20f9014ba960215d1e6953 100644 (file)
--- a/src/nginx.c
+++ b/src/nginx.c
curl_easy_setopt(curl, CURLOPT_PASSWORD, (pass == NULL) ? "" : pass);
#else
static char credentials[1024];
- int status = ssnprintf(credentials, sizeof(credentials), "%s:%s", user,
+ int status = snprintf(credentials, sizeof(credentials), "%s:%s", user,
pass == NULL ? "" : pass);
if ((status < 0) || ((size_t)status >= sizeof(credentials))) {
ERROR("nginx plugin: Credentials would have been truncated.");
diff --git a/src/notify_desktop.c b/src/notify_desktop.c
index d167fbfe69fcdf4b02d095a8be07384b9199017c..255230b13ec355f23b9f04da504cb1a1fc46ff12 100644 (file)
--- a/src/notify_desktop.c
+++ b/src/notify_desktop.c
timeout = fail_timeout;
}
- ssnprintf(summary, sizeof(summary), "collectd %s notification",
+ snprintf(summary, sizeof(summary), "collectd %s notification",
(NOTIF_FAILURE == n->severity)
? "FAILURE"
: (NOTIF_WARNING == n->severity)
diff --git a/src/notify_email.c b/src/notify_email.c
index c1ce2f8bbd9cd6fa3568cd3c5274e07215de0029..70408f6580f79b669a2e4439196388b7effe8b30 100644 (file)
--- a/src/notify_email.c
+++ b/src/notify_email.c
static int notify_email_init(void) {
char server[MAXSTRING];
- ssnprintf(server, sizeof(server), "%s:%i",
+ snprintf(server, sizeof(server), "%s:%i",
(smtp_host == NULL) ? DEFAULT_SMTP_HOST : smtp_host, smtp_port);
pthread_mutex_lock(&session_lock);
int buf_len = sizeof(buf);
int i;
- ssnprintf(severity, sizeof(severity), "%s",
+ snprintf(severity, sizeof(severity), "%s",
(n->severity == NOTIF_FAILURE)
? "FAILURE"
: ((n->severity == NOTIF_WARNING)
? "WARNING"
: ((n->severity == NOTIF_OKAY) ? "OKAY" : "UNKNOWN")));
- ssnprintf(subject, sizeof(subject),
+ snprintf(subject, sizeof(subject),
(email_subject == NULL) ? DEFAULT_SMTP_SUBJECT : email_subject,
severity, n->host);
timestamp_str[sizeof(timestamp_str) - 1] = '\0';
/* Let's make RFC822 message text with \r\n EOLs */
- ssnprintf(buf, buf_len, "MIME-Version: 1.0\r\n"
+ snprintf(buf, buf_len, "MIME-Version: 1.0\r\n"
"Content-Type: text/plain; charset=\"US-ASCII\"\r\n"
"Content-Transfer-Encoding: 8bit\r\n"
"Subject: %s\r\n"
diff --git a/src/notify_nagios.c b/src/notify_nagios.c
index c95f7cb99bf1ab139670a85ccd1e2b51c603d5ff..bea0faad3079093fbef68c77884014b5e6b5b375 100644 (file)
--- a/src/notify_nagios.c
+++ b/src/notify_nagios.c
break;
}
- ssnprintf(buffer, sizeof(buffer),
+ snprintf(buffer, sizeof(buffer),
"[%.0f] PROCESS_SERVICE_CHECK_RESULT;%s;%s;%d;%s\n",
CDTIME_T_TO_DOUBLE(n->time), n->host, &svc_description[1], code,
n->message);
diff --git a/src/ntpd.c b/src/ntpd.c
index 68ac3a75de6eac2883f8a9303a82eee6a11a2436..fb41a7d903eee9f147da3e22a4108a21c8700168 100644 (file)
--- a/src/ntpd.c
+++ b/src/ntpd.c
} else if (strcasecmp(key, "Port") == 0) {
int port = (int)(atof(value));
if ((port > 0) && (port <= 65535))
- ssnprintf(ntpd_port, sizeof(ntpd_port), "%i", port);
+ snprintf(ntpd_port, sizeof(ntpd_port), "%i", port);
else
sstrncpy(ntpd_port, value, sizeof(ntpd_port));
} else if (strcasecmp(key, "ReverseLookups") == 0) {
return ntpd_get_name_from_address(buffer, buffer_size, peer_info, 0);
if (include_unit_id)
- ssnprintf(buffer, buffer_size, "%s-%" PRIu32, refclock_names[refclock_id],
+ snprintf(buffer, buffer_size, "%s-%" PRIu32, refclock_names[refclock_id],
unit_id);
else
sstrncpy(buffer, refclock_names[refclock_id], buffer_size);
diff --git a/src/numa.c b/src/numa.c
index 6ef3f0909b095e0b1f3b87bd6fb61e4a46418c73..56ea707ccf648cc5b433add6af85a3d5344945fd 100644 (file)
--- a/src/numa.c
+++ b/src/numa.c
vl.values_len = 1;
sstrncpy(vl.plugin, "numa", sizeof(vl.plugin));
- ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "node%i", node);
+ snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "node%i", node);
sstrncpy(vl.type, "vmpage_action", sizeof(vl.type));
sstrncpy(vl.type_instance, type_instance, sizeof(vl.type_instance));
int status;
int success;
- ssnprintf(path, sizeof(path), NUMA_ROOT_DIR "/node%i/numastat", node);
+ snprintf(path, sizeof(path), NUMA_ROOT_DIR "/node%i/numastat", node);
fh = fopen(path, "r");
if (fh == NULL) {
struct stat statbuf = {0};
int status;
- ssnprintf(path, sizeof(path), NUMA_ROOT_DIR "/node%i", max_node + 1);
+ snprintf(path, sizeof(path), NUMA_ROOT_DIR "/node%i", max_node + 1);
status = stat(path, &statbuf);
if (status == 0) {
diff --git a/src/olsrd.c b/src/olsrd.c
index eccafae253340097671f46772648f0186e65f3d6..0e290ad89323a3ef32b6bb1b4485c0db7bae6780 100644 (file)
--- a/src/olsrd.c
+++ b/src/olsrd.c
if (config_want_links == OLSRD_WANT_DETAIL) {
char type_instance[DATA_MAX_NAME_LEN];
- ssnprintf(type_instance, sizeof(type_instance), "%s-%s-lq", fields[0],
+ snprintf(type_instance, sizeof(type_instance), "%s-%s-lq", fields[0],
fields[1]);
DEBUG("olsrd plugin: links: type_instance = %s; lq = %g;", type_instance,
if (config_want_links == OLSRD_WANT_DETAIL) {
char type_instance[DATA_MAX_NAME_LEN];
- ssnprintf(type_instance, sizeof(type_instance), "%s-%s-rx", fields[0],
+ snprintf(type_instance, sizeof(type_instance), "%s-%s-rx", fields[0],
fields[1]);
DEBUG("olsrd plugin: links: type_instance = %s; nlq = %g;", type_instance,
if (config_want_topology == OLSRD_WANT_DETAIL) {
char type_instance[DATA_MAX_NAME_LEN] = {0};
- ssnprintf(type_instance, sizeof(type_instance), "%s-%s-lq", fields[0],
+ snprintf(type_instance, sizeof(type_instance), "%s-%s-lq", fields[0],
fields[1]);
DEBUG("olsrd plugin: type_instance = %s; lq = %g;", type_instance, lq);
olsrd_submit(/* p.-inst = */ "topology", /* type = */ "signal_quality",
} else {
char type_instance[DATA_MAX_NAME_LEN] = {0};
- ssnprintf(type_instance, sizeof(type_instance), "%s-%s-nlq", fields[0],
+ snprintf(type_instance, sizeof(type_instance), "%s-%s-nlq", fields[0],
fields[1]);
DEBUG("olsrd plugin: type_instance = %s; nlq = %g;", type_instance, nlq);
olsrd_submit(/* p.-inst = */ "topology", /* type = */ "signal_quality",
diff --git a/src/onewire.c b/src/onewire.c
index 2d594ec9910e30f5e8cae46aaa0e1096b9034f02..5c5152db6dce1bf1b2501f673961091eb9df13c7 100644 (file)
--- a/src/onewire.c
+++ b/src/onewire.c
char subpath[4096];
int status;
- status = ssnprintf(subpath, sizeof(subpath), "%s/main", path);
+ status = snprintf(subpath, sizeof(subpath), "%s/main", path);
if ((status > 0) && (status < (int)sizeof(subpath)))
cow_read_bus(subpath);
- status = ssnprintf(subpath, sizeof(subpath), "%s/aux", path);
+ status = snprintf(subpath, sizeof(subpath), "%s/aux", path);
if ((status > 0) && (status < (int)sizeof(subpath)))
cow_read_bus(subpath);
dummy = NULL;
if (strcmp("/", path) == 0)
- status = ssnprintf(subpath, sizeof(subpath), "/%s", buffer_ptr);
+ status = snprintf(subpath, sizeof(subpath), "/%s", buffer_ptr);
else
- status = ssnprintf(subpath, sizeof(subpath), "%s/%s", path, buffer_ptr);
+ status = snprintf(subpath, sizeof(subpath), "%s/%s", path, buffer_ptr);
if ((status <= 0) || (status >= (int)sizeof(subpath)))
continue;
diff --git a/src/openldap.c b/src/openldap.c
index 8053929015935ca6e2be51a66f09484c05803ef0..7b9b711c2d80b1d7228aa982f2bf15c25c0c7c08 100644 (file)
--- a/src/openldap.c
+++ b/src/openldap.c
if ((olmbdb_list =
ldap_get_values_len(st->ld, e, "olmBDBEntryCache")) != NULL) {
olmbdb_data = *olmbdb_list[0];
- ssnprintf(typeinst, sizeof(typeinst), "bdbentrycache-%s",
+ snprintf(typeinst, sizeof(typeinst), "bdbentrycache-%s",
nc_data.bv_val);
cldap_submit_gauge("cache_size", typeinst, atoll(olmbdb_data.bv_val),
st);
if ((olmbdb_list = ldap_get_values_len(st->ld, e, "olmBDBDNCache")) !=
NULL) {
olmbdb_data = *olmbdb_list[0];
- ssnprintf(typeinst, sizeof(typeinst), "bdbdncache-%s",
+ snprintf(typeinst, sizeof(typeinst), "bdbdncache-%s",
nc_data.bv_val);
cldap_submit_gauge("cache_size", typeinst, atoll(olmbdb_data.bv_val),
st);
if ((olmbdb_list = ldap_get_values_len(st->ld, e, "olmBDBIDLCache")) !=
NULL) {
olmbdb_data = *olmbdb_list[0];
- ssnprintf(typeinst, sizeof(typeinst), "bdbidlcache-%s",
+ snprintf(typeinst, sizeof(typeinst), "bdbidlcache-%s",
nc_data.bv_val);
cldap_submit_gauge("cache_size", typeinst, atoll(olmbdb_data.bv_val),
st);
databases[databases_num] = st;
databases_num++;
- ssnprintf(callback_name, sizeof(callback_name), "openldap/%s/%s",
+ snprintf(callback_name, sizeof(callback_name), "openldap/%s/%s",
(st->host != NULL) ? st->host : hostname_g,
(st->name != NULL) ? st->name : "default");
diff --git a/src/oracle.c b/src/oracle.c
index 2d98f0aa3d2734fc682e8534ff76d623647f64e3..2199df264033e75241842e1396a0002c172b15b0 100644 (file)
--- a/src/oracle.c
+++ b/src/oracle.c
if ((status != OCI_SUCCESS) && (status != OCI_SUCCESS_WITH_INFO)) {
char errfunc[256];
- ssnprintf(errfunc, sizeof(errfunc), "OCILogon(\"%s\")", db->connect_id);
+ snprintf(errfunc, sizeof(errfunc), "OCILogon(\"%s\")", db->connect_id);
o_report_error("o_read_database", db->name, NULL, errfunc, oci_error);
DEBUG("oracle plugin: OCILogon (%s): db->oci_service_context = %p;",
diff --git a/src/ovs_events.c b/src/ovs_events.c
index 65042343215adb4d31d723a7d36cd4a5a56cd86c..2499cb4643affe1428a698113a116f0c1bdfb20a 100644 (file)
--- a/src/ovs_events.c
+++ b/src/ovs_events.c
return NULL;
}
opt_buff = new_buff;
- int ret = ssnprintf(opt_buff + buff_off, buff_size - buff_off, option_fmt,
+ int ret = snprintf(opt_buff + buff_off, buff_size - buff_off, option_fmt,
iface->name);
if (ret < 0) {
sfree(opt_buff);
}
/* create OVS DB select params */
- if (ssnprintf(params_buff, params_size, params_fmt, opt_buff) < 0)
+ if (snprintf(params_buff, params_size, params_fmt, opt_buff) < 0)
sfree(params_buff);
sfree(opt_buff);
@@ -334,7 +334,7 @@ static void ovs_events_dispatch_notification(const ovs_events_iface_info_t *ifin
}
/* fill the notification data */
- ssnprintf(n.message, sizeof(n.message),
+ snprintf(n.message, sizeof(n.message),
"link state of \"%s\" interface has been changed to \"%s\"",
ifinfo->name, msg_link_status);
sstrncpy(n.host, hostname_g, sizeof(n.host));
diff --git a/src/perl.c b/src/perl.c
index e922badf9f924e6d4ff8e514252fa97bde2153d9..abef87c2f6b927604e614e482eb510b9d5e73e77 100644 (file)
--- a/src/perl.c
+++ b/src/perl.c
static char *get_module_name(char *buf, size_t buf_len, const char *module) {
int status = 0;
if (base_name[0] == '\0')
- status = ssnprintf(buf, buf_len, "%s", module);
+ status = snprintf(buf, buf_len, "%s", module);
else
- status = ssnprintf(buf, buf_len, "%s::%s", base_name, module);
+ status = snprintf(buf, buf_len, "%s::%s", base_name, module);
if ((status < 0) || ((unsigned int)status >= buf_len))
return NULL;
return buf;
diff --git a/src/postgresql.c b/src/postgresql.c
index d0c0ae1324a457e5aeb706196536878fbea10a11..a0a1a2717558356657998324fa4f12408c740af0 100644 (file)
--- a/src/postgresql.c
+++ b/src/postgresql.c
* is ignored. */
#define C_PSQL_PAR_APPEND(buf, buf_len, parameter, value) \
if ((0 < (buf_len)) && (NULL != (value)) && ('\0' != *(value))) { \
- int s = ssnprintf(buf, buf_len, " %s = '%s'", parameter, value); \
+ int s = snprintf(buf, buf_len, " %s = '%s'", parameter, value); \
if (0 < s) { \
buf += s; \
buf_len -= s; \
if ((!db) || (!db->database))
return -1;
- status = ssnprintf(buf, buf_len, "dbname = '%s'", db->database);
+ status = snprintf(buf, buf_len, "dbname = '%s'", db->database);
if (0 < status) {
buf += status;
buf_len -= status;
@@ -424,7 +424,7 @@ static PGresult *c_psql_exec_query_params(c_psql_database_t *db, udb_query_t *q,
params[i] = db->user;
break;
case C_PSQL_PARAM_INTERVAL:
- ssnprintf(interval, sizeof(interval), "%.3f",
+ snprintf(interval, sizeof(interval), "%.3f",
(db->interval > 0) ? CDTIME_T_TO_DOUBLE(db->interval)
: plugin_get_interval());
params[i] = interval;
str_len = string_len;
for (size_t i = 0; i < ds->ds_num; ++i) {
- int status = ssnprintf(str_ptr, str_len, ",'%s'", ds->ds[i].name);
+ int status = snprintf(str_ptr, str_len, ",'%s'", ds->ds[i].name);
if (status < 1)
return NULL;
int status;
if (store_rates)
- status = ssnprintf(str_ptr, str_len, ",'gauge'");
+ status = snprintf(str_ptr, str_len, ",'gauge'");
else
- status = ssnprintf(str_ptr, str_len, ",'%s'",
+ status = snprintf(str_ptr, str_len, ",'%s'",
DS_TYPE_TO_STRING(ds->ds[i].type));
if (status < 1) {
if (ds->ds[i].type == DS_TYPE_GAUGE)
status =
- ssnprintf(str_ptr, str_len, "," GAUGE_FORMAT, vl->values[i].gauge);
+ snprintf(str_ptr, str_len, "," GAUGE_FORMAT, vl->values[i].gauge);
else if (store_rates) {
if (rates == NULL)
rates = uc_get_rate(ds, vl);
return NULL;
}
- status = ssnprintf(str_ptr, str_len, ",%lf", rates[i]);
+ status = snprintf(str_ptr, str_len, ",%lf", rates[i]);
} else if (ds->ds[i].type == DS_TYPE_COUNTER)
- status = ssnprintf(str_ptr, str_len, ",%llu", vl->values[i].counter);
+ status = snprintf(str_ptr, str_len, ",%llu", vl->values[i].counter);
else if (ds->ds[i].type == DS_TYPE_DERIVE)
- status = ssnprintf(str_ptr, str_len, ",%" PRIi64, vl->values[i].derive);
+ status = snprintf(str_ptr, str_len, ",%" PRIi64, vl->values[i].derive);
else if (ds->ds[i].type == DS_TYPE_ABSOLUTE)
- status = ssnprintf(str_ptr, str_len, ",%" PRIu64, vl->values[i].absolute);
+ status = snprintf(str_ptr, str_len, ",%" PRIu64, vl->values[i].absolute);
if (status < 1) {
str_len = 0;
if (db->writers_num > 0) {
char cb_name[DATA_MAX_NAME_LEN];
- ssnprintf(cb_name, sizeof(cb_name), "postgresql-%s", db->database);
+ snprintf(cb_name, sizeof(cb_name), "postgresql-%s", db->database);
if (!had_flush) {
plugin_unregister_flush("postgresql");
}
}
- ssnprintf(cb_name, sizeof(cb_name), "postgresql-%s", db->instance);
+ snprintf(cb_name, sizeof(cb_name), "postgresql-%s", db->instance);
user_data_t ud = {.data = db, .free_func = c_psql_database_delete};
diff --git a/src/processes.c b/src/processes.c
index 82a485900537e891336ac5185c67cd951ed33d28..17918c47e7abf1e3fd6eddbed6a14ffdd26795f7 100644 (file)
--- a/src/processes.c
+++ b/src/processes.c
char *fields[8];
int numfields;
- ssnprintf(dirname, sizeof(dirname), "/proc/%li/task", ps->id);
+ snprintf(dirname, sizeof(dirname), "/proc/%li/task", ps->id);
if ((dh = opendir(dirname)) == NULL) {
DEBUG("Failed to open directory `%s'", dirname);
tpid = ent->d_name;
- ssnprintf(filename, sizeof(filename), "/proc/%li/task/%s/status", ps->id,
+ snprintf(filename, sizeof(filename), "/proc/%li/task/%s/status", ps->id,
tpid);
if ((fh = fopen(filename, "r")) == NULL) {
DEBUG("Failed to open file `%s'", filename);
char *fields[8];
int numfields;
- ssnprintf(filename, sizeof(filename), "/proc/%li/status", pid);
+ snprintf(filename, sizeof(filename), "/proc/%li/status", pid);
if ((fh = fopen(filename, "r")) == NULL)
return -1;
char *fields[8];
int numfields;
- ssnprintf(filename, sizeof(filename), "/proc/%li/io", ps->id);
+ snprintf(filename, sizeof(filename), "/proc/%li/io", ps->id);
if ((fh = fopen(filename, "r")) == NULL) {
DEBUG("ps_read_io: Failed to open file `%s'", filename);
return -1;
struct dirent *ent;
int count = 0;
- ssnprintf(dirname, sizeof(dirname), "/proc/%i/fd", pid);
+ snprintf(dirname, sizeof(dirname), "/proc/%i/fd", pid);
if ((dh = opendir(dirname)) == NULL) {
DEBUG("Failed to open directory `%s'", dirname);
ssize_t status;
- ssnprintf(filename, sizeof(filename), "/proc/%li/stat", pid);
+ snprintf(filename, sizeof(filename), "/proc/%li/stat", pid);
status = read_file_contents(filename, buffer, sizeof(buffer) - 1);
if (status <= 0)
@@ -1165,7 +1165,7 @@ static char *ps_get_cmdline(long pid, char *name, char *buf, size_t buf_len) {
if ((pid < 1) || (NULL == buf) || (buf_len < 2))
return NULL;
- ssnprintf(file, sizeof(file), "/proc/%li/cmdline", pid);
+ snprintf(file, sizeof(file), "/proc/%li/cmdline", pid);
errno = 0;
fd = open(file, O_RDONLY);
@@ -1220,7 +1220,7 @@ static char *ps_get_cmdline(long pid, char *name, char *buf, size_t buf_len) {
if (NULL == name)
return NULL;
- ssnprintf(buf, buf_len, "[%s]", name);
+ snprintf(buf, buf_len, "[%s]", name);
return buf;
}
diff --git a/src/protocols.c b/src/protocols.c
index 32e98243d9c2f54f312dba8c866adb93c0d58b68..47f7a08a3f12d907ad81caadcab5f8b6cd4daa06 100644 (file)
--- a/src/protocols.c
+++ b/src/protocols.c
if (values_list != NULL) {
char match_name[2 * DATA_MAX_NAME_LEN];
- ssnprintf(match_name, sizeof(match_name), "%s:%s", key_buffer,
+ snprintf(match_name, sizeof(match_name), "%s:%s", key_buffer,
key_fields[i]);
if (ignorelist_match(values_list, match_name))
diff --git a/src/redis.c b/src/redis.c
index 05225b5bfb2e78ee0aab6ab14feb6e9dd3c36148..7c704ab5586ff1598fb422ba50c77b5064a68ee8 100644 (file)
--- a/src/redis.c
+++ b/src/redis.c
char *str;
int i;
- ssnprintf(field_name, sizeof(field_name), "db%d:keys=", db);
+ snprintf(field_name, sizeof(field_name), "db%d:keys=", db);
str = strstr(info_line, field_name);
if (!str)
return -1;
}
- ssnprintf(db_id, sizeof(db_id), "%d", db);
+ snprintf(db_id, sizeof(db_id), "%d", db);
redis_submit(node, "records", db_id, val);
}
return 0;
diff --git a/src/routeros.c b/src/routeros.c
index ba92b0b213d372ca4e84d1123f869f7c2bc7a2f0..8e25919355a00da05a3cccbad943b6222c2597ae 100644 (file)
--- a/src/routeros.c
+++ b/src/routeros.c
return;
/*** RX ***/
- ssnprintf(type_instance, sizeof(type_instance), "%s-%s-rx", r->interface,
+ snprintf(type_instance, sizeof(type_instance), "%s-%s-rx", r->interface,
r->radio_name);
cr_submit_gauge(rd, "bitrate", type_instance,
(gauge_t)(1000000.0 * r->rx_rate));
cr_submit_gauge(rd, "signal_quality", type_instance, (gauge_t)r->rx_ccq);
/*** TX ***/
- ssnprintf(type_instance, sizeof(type_instance), "%s-%s-tx", r->interface,
+ snprintf(type_instance, sizeof(type_instance), "%s-%s-tx", r->interface,
r->radio_name);
cr_submit_gauge(rd, "bitrate", type_instance,
(gauge_t)(1000000.0 * r->tx_rate));
cr_submit_gauge(rd, "signal_quality", type_instance, (gauge_t)r->tx_ccq);
/*** RX / TX ***/
- ssnprintf(type_instance, sizeof(type_instance), "%s-%s", r->interface,
+ snprintf(type_instance, sizeof(type_instance), "%s-%s", r->interface,
r->radio_name);
cr_submit_io(rd, "if_octets", type_instance, (derive_t)r->rx_bytes,
(derive_t)r->tx_bytes);
}
}
- ssnprintf(read_name, sizeof(read_name), "routeros/%s", router_data->node);
+ snprintf(read_name, sizeof(read_name), "routeros/%s", router_data->node);
if (status == 0)
status = plugin_register_complex_read(
/* group = */ NULL, read_name, cr_read, /* interval = */ 0,
diff --git a/src/rrdcached.c b/src/rrdcached.c
index 4efb1f0cdc0b480bca0ce33ff641711fdb807081..061177351df6724660c72daea5dfe43fa2ca81ac 100644 (file)
--- a/src/rrdcached.c
+++ b/src/rrdcached.c
memset(buffer, '\0', buffer_len);
t = CDTIME_T_TO_TIME_T(vl->time);
- status = ssnprintf(buffer, buffer_len, "%lu", (unsigned long)t);
+ status = snprintf(buffer, buffer_len, "%lu", (unsigned long)t);
if ((status < 1) || (status >= buffer_len))
return -1;
offset = status;
return -1;
if (ds->ds[i].type == DS_TYPE_COUNTER) {
- status = ssnprintf(buffer + offset, buffer_len - offset, ":%llu",
+ status = snprintf(buffer + offset, buffer_len - offset, ":%llu",
vl->values[i].counter);
} else if (ds->ds[i].type == DS_TYPE_GAUGE) {
- status = ssnprintf(buffer + offset, buffer_len - offset, ":%f",
+ status = snprintf(buffer + offset, buffer_len - offset, ":%f",
vl->values[i].gauge);
} else if (ds->ds[i].type == DS_TYPE_DERIVE) {
- status = ssnprintf(buffer + offset, buffer_len - offset, ":%" PRIi64,
+ status = snprintf(buffer + offset, buffer_len - offset, ":%" PRIi64,
vl->values[i].derive);
} else /* if (ds->ds[i].type == DS_TYPE_ABSOLUTE) */ {
- status = ssnprintf(buffer + offset, buffer_len - offset, ":%" PRIu64,
+ status = snprintf(buffer + offset, buffer_len - offset, ":%" PRIu64,
vl->values[i].absolute);
}
return EINVAL;
if (datadir != NULL)
- ssnprintf(filename, sizeof(filename), "%s/%s.rrd", datadir, identifier);
+ snprintf(filename, sizeof(filename), "%s/%s.rrd", datadir, identifier);
else
- ssnprintf(filename, sizeof(filename), "%s.rrd", identifier);
+ snprintf(filename, sizeof(filename), "%s.rrd", identifier);
rrd_clear_error();
status = rrdc_connect(daemon_address);
diff --git a/src/rrdtool.c b/src/rrdtool.c
index 5a71ebe827506cae7228cea8025cd62354f76d32..885bcebb9ba87d27510e234e8ed4db9741b084c9 100644 (file)
--- a/src/rrdtool.c
+++ b/src/rrdtool.c
memset(buffer, '\0', buffer_len);
tt = CDTIME_T_TO_TIME_T(vl->time);
- status = ssnprintf(buffer, buffer_len, "%u", (unsigned int)tt);
+ status = snprintf(buffer, buffer_len, "%u", (unsigned int)tt);
if ((status < 1) || (status >= buffer_len))
return -1;
offset = status;
return -1;
if (ds->ds[i].type == DS_TYPE_COUNTER)
- status = ssnprintf(buffer + offset, buffer_len - offset, ":%llu",
+ status = snprintf(buffer + offset, buffer_len - offset, ":%llu",
vl->values[i].counter);
else if (ds->ds[i].type == DS_TYPE_GAUGE)
- status = ssnprintf(buffer + offset, buffer_len - offset, ":" GAUGE_FORMAT,
+ status = snprintf(buffer + offset, buffer_len - offset, ":" GAUGE_FORMAT,
vl->values[i].gauge);
else if (ds->ds[i].type == DS_TYPE_DERIVE)
- status = ssnprintf(buffer + offset, buffer_len - offset, ":%" PRIi64,
+ status = snprintf(buffer + offset, buffer_len - offset, ":%" PRIi64,
vl->values[i].derive);
else /*if (ds->ds[i].type == DS_TYPE_ABSOLUTE) */
- status = ssnprintf(buffer + offset, buffer_len - offset, ":%" PRIu64,
+ status = snprintf(buffer + offset, buffer_len - offset, ":%" PRIu64,
vl->values[i].absolute);
if ((status < 1) || (status >= (buffer_len - offset)))
tt = CDTIME_T_TO_TIME_T(vl->time);
switch (ds->ds[0].type) {
case DS_TYPE_DERIVE:
- status = ssnprintf(buffer, buffer_len, "%u:%" PRIi64, (unsigned)tt,
+ status = snprintf(buffer, buffer_len, "%u:%" PRIi64, (unsigned)tt,
vl->values[0].derive);
break;
case DS_TYPE_GAUGE:
- status = ssnprintf(buffer, buffer_len, "%u:" GAUGE_FORMAT, (unsigned)tt,
+ status = snprintf(buffer, buffer_len, "%u:" GAUGE_FORMAT, (unsigned)tt,
vl->values[0].gauge);
break;
case DS_TYPE_COUNTER:
- status = ssnprintf(buffer, buffer_len, "%u:%llu", (unsigned)tt,
+ status = snprintf(buffer, buffer_len, "%u:%llu", (unsigned)tt,
vl->values[0].counter);
break;
case DS_TYPE_ABSOLUTE:
- status = ssnprintf(buffer, buffer_len, "%u:%" PRIu64, (unsigned)tt,
+ status = snprintf(buffer, buffer_len, "%u:%" PRIu64, (unsigned)tt,
vl->values[0].absolute);
break;
default:
diff --git a/src/sensors.c b/src/sensors.c
index ed87c30c251318a543a07a229bd48a81dd62931a..27739330cb09f11887911254f7215e8fa2769268 100644 (file)
--- a/src/sensors.c
+++ b/src/sensors.c
int status = -1;
if (chip->bus == SENSORS_CHIP_NAME_BUS_ISA) {
- status = ssnprintf(buf, buf_size, "%s-isa-%04x", chip->prefix, chip->addr);
+ status = snprintf(buf, buf_size, "%s-isa-%04x", chip->prefix, chip->addr);
} else if (chip->bus == SENSORS_CHIP_NAME_BUS_DUMMY) {
status = snprintf(buf, buf_size, "%s-%s-%04x", chip->prefix, chip->busname,
chip->addr);
value_list_t vl = VALUE_LIST_INIT;
- status = ssnprintf(match_key, sizeof(match_key), "%s/%s-%s", plugin_instance,
+ status = snprintf(match_key, sizeof(match_key), "%s/%s-%s", plugin_instance,
type, type_instance);
if (status < 1)
return;
diff --git a/src/sigrok.c b/src/sigrok.c
index 44920ada0b9d28d8648f0ddb0291ed3d87f56a8d..6d4cb976ceaa6e220be1371ac1ce85e6ddcaff73 100644 (file)
--- a/src/sigrok.c
+++ b/src/sigrok.c
}
cfdev->sdi = devlist->data;
g_slist_free(devlist);
- ssnprintf(hwident, sizeof(hwident), "%s %s %s",
+ snprintf(hwident, sizeof(hwident), "%s %s %s",
cfdev->sdi->vendor ? cfdev->sdi->vendor : "",
cfdev->sdi->model ? cfdev->sdi->model : "",
cfdev->sdi->version ? cfdev->sdi->version : "");
diff --git a/src/smart.c b/src/smart.c
index 0e4e192c56579ecd7641c37eb31c8b07ad9da1a8..f5850f5f4d12269156e038e2b7860b5a89594239 100644 (file)
--- a/src/smart.c
+++ b/src/smart.c
sstrncpy(notif.host, hostname_g, sizeof(notif.host));
sstrncpy(notif.plugin_instance, name, sizeof(notif.plugin_instance));
sstrncpy(notif.type_instance, a->name, sizeof(notif.type_instance));
- ssnprintf(notif.message, sizeof(notif.message),
+ snprintf(notif.message, sizeof(notif.message),
"attribute %s is below allowed threshold (%d < %d)", a->name,
a->current_value, a->threshold);
plugin_dispatch_notification(¬if);
diff --git a/src/snmp.c b/src/snmp.c
index 77349f62cc68e88d7c21b81a1c48c0d597dd324d..ae2b0d46db1166bab01dae22d04d6ed92bd303fa 100644 (file)
--- a/src/snmp.c
+++ b/src/snmp.c
char *oid_str_ptr[MAX_OID_LEN];
for (size_t i = 0; i < o->oid_len; i++) {
- ssnprintf(oid_str[i], sizeof(oid_str[i]), "%lu", (unsigned long)o->oid[i]);
+ snprintf(oid_str[i], sizeof(oid_str[i]), "%lu", (unsigned long)o->oid[i]);
oid_str_ptr[i] = oid_str[i];
}
"= %i }",
hd->name, hd->address, hd->community, hd->version);
- ssnprintf(cb_name, sizeof(cb_name), "snmp-%s", hd->name);
+ snprintf(cb_name, sizeof(cb_name), "snmp-%s", hd->name);
status = plugin_register_complex_read(
/* group = */ NULL, cb_name, csnmp_read_host, hd->interval,
else if (vb->type == ASN_BIT_STR)
src = (char *)vb->val.bitstring;
else if (vb->type == ASN_IPADDRESS) {
- return ssnprintf(dst, dst_size,
+ return snprintf(dst, dst_size,
"%" PRIu8 ".%" PRIu8 ".%" PRIu8 ".%" PRIu8 "",
(uint8_t)vb->val.string[0], (uint8_t)vb->val.string[1],
(uint8_t)vb->val.string[2], (uint8_t)vb->val.string[3]);
value_t val = csnmp_value_list_to_value(
vb, DS_TYPE_COUNTER,
/* scale = */ 1.0, /* shift = */ 0.0, hd->name, dd->name);
- ssnprintf(il->instance, sizeof(il->instance), "%llu", val.counter);
+ snprintf(il->instance, sizeof(il->instance), "%llu", val.counter);
}
/* TODO: Debugging output */
if (data->instance_prefix == NULL)
sstrncpy(vl.type_instance, temp, sizeof(vl.type_instance));
else
- ssnprintf(vl.type_instance, sizeof(vl.type_instance), "%s%s",
+ snprintf(vl.type_instance, sizeof(vl.type_instance), "%s%s",
data->instance_prefix, temp);
}
diff --git a/src/snmp_agent.c b/src/snmp_agent.c
index d7aea2d27075bb8427df57b62560ca4df9d634b8..8441601b098a8c496d2abd7882c459fce6ee0001 100644 (file)
--- a/src/snmp_agent.c
+++ b/src/snmp_agent.c
char *oid_str_ptr[MAX_OID_LEN];
for (size_t i = 0; i < o->oid_len; i++) {
- ssnprintf(oid_str[i], sizeof(oid_str[i]), "%lu", (unsigned long)o->oid[i]);
+ snprintf(oid_str[i], sizeof(oid_str[i]), "%lu", (unsigned long)o->oid[i]);
oid_str_ptr[i] = oid_str[i];
}
.severity = NOTIF_WARNING, .time = cdtime(), .plugin = PLUGIN_NAME};
sstrncpy(n.host, hostname_g, sizeof(n.host));
sstrncpy(n.plugin_instance, ins, sizeof(n.plugin_instance));
- ssnprintf(n.message, sizeof(n.message),
+ snprintf(n.message, sizeof(n.message),
"Removed data row from table %s instance %s index %d", td->name,
ins, (index != NULL) ? *index : -1);
plugin_dispatch_notification(&n);
.severity = NOTIF_OKAY, .time = cdtime(), .plugin = PLUGIN_NAME};
sstrncpy(n.host, hostname_g, sizeof(n.host));
sstrncpy(n.plugin_instance, ins, sizeof(n.plugin_instance));
- ssnprintf(n.message, sizeof(n.message),
+ snprintf(n.message, sizeof(n.message),
"Data row added to table %s instance %s index %d", td->name, ins,
(index != NULL) ? *index : -1);
plugin_dispatch_notification(&n);
diff --git a/src/statsd.c b/src/statsd.c
index e1b52cbc70651333eb5625b66449c2e637119b77..3310bc45f22fe366bf8dece8fc937993b8a0ef7c 100644 (file)
--- a/src/statsd.c
+++ b/src/statsd.c
/* Make sure all timer metrics share the *same* timestamp. */
vl.time = cdtime();
- ssnprintf(vl.type_instance, sizeof(vl.type_instance), "%s-average", name);
+ snprintf(vl.type_instance, sizeof(vl.type_instance), "%s-average", name);
vl.values[0].gauge =
have_events
? CDTIME_T_TO_DOUBLE(latency_counter_get_average(metric->latency))
plugin_dispatch_values(&vl);
if (conf_timer_lower) {
- ssnprintf(vl.type_instance, sizeof(vl.type_instance), "%s-lower", name);
+ snprintf(vl.type_instance, sizeof(vl.type_instance), "%s-lower", name);
vl.values[0].gauge =
have_events
? CDTIME_T_TO_DOUBLE(latency_counter_get_min(metric->latency))
}
if (conf_timer_upper) {
- ssnprintf(vl.type_instance, sizeof(vl.type_instance), "%s-upper", name);
+ snprintf(vl.type_instance, sizeof(vl.type_instance), "%s-upper", name);
vl.values[0].gauge =
have_events
? CDTIME_T_TO_DOUBLE(latency_counter_get_max(metric->latency))
}
if (conf_timer_sum) {
- ssnprintf(vl.type_instance, sizeof(vl.type_instance), "%s-sum", name);
+ snprintf(vl.type_instance, sizeof(vl.type_instance), "%s-sum", name);
vl.values[0].gauge =
have_events
? CDTIME_T_TO_DOUBLE(latency_counter_get_sum(metric->latency))
}
for (size_t i = 0; i < conf_timer_percentile_num; i++) {
- ssnprintf(vl.type_instance, sizeof(vl.type_instance),
+ snprintf(vl.type_instance, sizeof(vl.type_instance),
"%s-percentile-%.0f", name, conf_timer_percentile[i]);
vl.values[0].gauge =
have_events ? CDTIME_T_TO_DOUBLE(latency_counter_get_percentile(
* vl.type's above are implicitly set to "latency". */
if (conf_timer_count) {
sstrncpy(vl.type, "gauge", sizeof(vl.type));
- ssnprintf(vl.type_instance, sizeof(vl.type_instance), "%s-count", name);
+ snprintf(vl.type_instance, sizeof(vl.type_instance), "%s-count", name);
vl.values[0].gauge = latency_counter_get_num(metric->latency);
plugin_dispatch_values(&vl);
}
diff --git a/src/syslog.c b/src/syslog.c
index 8192d6a151897bdaa0466946ba18abdc27e62a3a..55de164bc42a7e9d890d12cedb09c2da92477c17 100644 (file)
--- a/src/syslog.c
+++ b/src/syslog.c
#define BUFFER_ADD(...) \
do { \
- status = ssnprintf(&buf[offset], sizeof(buf) - offset, __VA_ARGS__); \
+ status = snprintf(&buf[offset], sizeof(buf) - offset, __VA_ARGS__); \
if (status < 1) \
return -1; \
else if (((size_t)status) >= (sizeof(buf) - offset)) \
diff --git a/src/tail.c b/src/tail.c
index 1b720b83af2fe8e52b1a58010ac29ebb9c2e6fdd..407970ae70e947fe2a5f7d0bf12d1106700baf68 100644 (file)
--- a/src/tail.c
+++ b/src/tail.c
}
for (size_t i = 0; i < tail_match_list_num; i++) {
- ssnprintf(str, sizeof(str), "tail-%zu", i);
+ snprintf(str, sizeof(str), "tail-%zu", i);
plugin_register_complex_read(NULL, str, ctail_read,
tail_match_list_intervals[i],
diff --git a/src/tail_csv.c b/src/tail_csv.c
index d512a52ee8188aef675dc1e6378cd09147e508d3..9d0a15bee75444d03111eb402250c1b1d96d33d7 100644 (file)
--- a/src/tail_csv.c
+++ b/src/tail_csv.c
return -1;
}
- ssnprintf(cb_name, sizeof(cb_name), "tail_csv/%s", id->path);
+ snprintf(cb_name, sizeof(cb_name), "tail_csv/%s", id->path);
status = plugin_register_complex_read(
NULL, cb_name, tcsv_read, id->interval,
index 2041510ff97934714bc0ea62b7738d02fdf8fef5..ffd76dc552e406a9b91f22e73bd0599e7e4e7798 100644 (file)
char template[DATA_MAX_NAME_LEN];
char value_str[DATA_MAX_NAME_LEN];
- ssnprintf(template, sizeof(template), "%%{ds:%s}", ds->ds[i].name);
+ snprintf(template, sizeof(template), "%%{ds:%s}", ds->ds[i].name);
if (ds->ds[i].type != DS_TYPE_GAUGE) {
if ((rates == NULL) && (rates_failed == 0)) {
/* If this is a gauge value, use the current value. */
if (ds->ds[i].type == DS_TYPE_GAUGE)
- ssnprintf(value_str, sizeof(value_str), GAUGE_FORMAT,
+ snprintf(value_str, sizeof(value_str), GAUGE_FORMAT,
(double)vl->values[i].gauge);
/* If it's a counter, try to use the current rate. This may fail, if the
* value has been renamed. */
else if (rates != NULL)
- ssnprintf(value_str, sizeof(value_str), GAUGE_FORMAT, (double)rates[i]);
+ snprintf(value_str, sizeof(value_str), GAUGE_FORMAT, (double)rates[i]);
/* Since we don't know any better, use the string `unknown'. */
else
sstrncpy(value_str, "unknown", sizeof(value_str));
diff --git a/src/target_scale.c b/src/target_scale.c
index 8ec53d48514e50b0e80dbc885d962b26215106c6..e58bf1806192c60648d69eb3453b3164690ee932 100644 (file)
--- a/src/target_scale.c
+++ b/src/target_scale.c
curr_counter = (uint64_t)vl->values[dsrc_index].counter;
- ssnprintf(key_prev_counter, sizeof(key_prev_counter),
+ snprintf(key_prev_counter, sizeof(key_prev_counter),
"target_scale[%p,%i]:prev_counter", (void *)data, dsrc_index);
- ssnprintf(key_int_counter, sizeof(key_int_counter),
+ snprintf(key_int_counter, sizeof(key_int_counter),
"target_scale[%p,%i]:int_counter", (void *)data, dsrc_index);
- ssnprintf(key_int_fraction, sizeof(key_int_fraction),
+ snprintf(key_int_fraction, sizeof(key_int_fraction),
"target_scale[%p,%i]:int_fraction", (void *)data, dsrc_index);
prev_counter = curr_counter;
curr_derive = (int64_t)vl->values[dsrc_index].derive;
- ssnprintf(key_prev_derive, sizeof(key_prev_derive),
+ snprintf(key_prev_derive, sizeof(key_prev_derive),
"target_scale[%p,%i]:prev_derive", (void *)data, dsrc_index);
- ssnprintf(key_int_derive, sizeof(key_int_derive),
+ snprintf(key_int_derive, sizeof(key_int_derive),
"target_scale[%p,%i]:int_derive", (void *)data, dsrc_index);
- ssnprintf(key_int_fraction, sizeof(key_int_fraction),
+ snprintf(key_int_fraction, sizeof(key_int_fraction),
"target_scale[%p,%i]:int_fraction", (void *)data, dsrc_index);
prev_derive = curr_derive;
curr_absolute = (uint64_t)vl->values[dsrc_index].absolute;
- ssnprintf(key_int_fraction, sizeof(key_int_fraction),
+ snprintf(key_int_fraction, sizeof(key_int_fraction),
"target_scale[%p,%i]:int_fraction", (void *)data, dsrc_index);
int_fraction = 0.0;
diff --git a/src/target_set.c b/src/target_set.c
index e3ec26924fbcb60160890c7d63cea9a3aa5b23d0..33ab96c9a5a698145dd7b8c87b00e97d48db5b64 100644 (file)
--- a/src/target_set.c
+++ b/src/target_set.c
char *value_str;
const char *key = meta_toc[i];
- ssnprintf(meta_name, sizeof(meta_name), "%%{meta:%s}", key);
+ snprintf(meta_name, sizeof(meta_name), "%%{meta:%s}", key);
if (meta_data_as_string(vl->meta, key, &value_str) != 0)
continue;
diff --git a/src/target_v5upgrade.c b/src/target_v5upgrade.c
index 90f8e005883cf42d467e1326545116a23ed8962b..34083b6dbebb97fdf8bdcffd0eb4a947e17131ee 100644 (file)
--- a/src/target_v5upgrade.c
+++ b/src/target_v5upgrade.c
@@ -238,22 +238,22 @@ static int v5_zfs_arc_counts(const data_set_t *ds, value_list_t *vl) /* {{{ */
/* Dispatch new value lists instead of this one */
new_vl.values[0].derive = (derive_t)vl->values[0].counter;
- ssnprintf(new_vl.type_instance, sizeof(new_vl.type_instance),
+ snprintf(new_vl.type_instance, sizeof(new_vl.type_instance),
"demand_data-%s", is_hits ? "hit" : "miss");
plugin_dispatch_values(&new_vl);
new_vl.values[0].derive = (derive_t)vl->values[1].counter;
- ssnprintf(new_vl.type_instance, sizeof(new_vl.type_instance),
+ snprintf(new_vl.type_instance, sizeof(new_vl.type_instance),
"demand_metadata-%s", is_hits ? "hit" : "miss");
plugin_dispatch_values(&new_vl);
new_vl.values[0].derive = (derive_t)vl->values[2].counter;
- ssnprintf(new_vl.type_instance, sizeof(new_vl.type_instance),
+ snprintf(new_vl.type_instance, sizeof(new_vl.type_instance),
"prefetch_data-%s", is_hits ? "hit" : "miss");
plugin_dispatch_values(&new_vl);
new_vl.values[0].derive = (derive_t)vl->values[3].counter;
- ssnprintf(new_vl.type_instance, sizeof(new_vl.type_instance),
+ snprintf(new_vl.type_instance, sizeof(new_vl.type_instance),
"prefetch_metadata-%s", is_hits ? "hit" : "miss");
plugin_dispatch_values(&new_vl);
diff --git a/src/tcpconns.c b/src/tcpconns.c
index f12ce5c6969583f8b6aa93eb9f3770c0f8b951c6..732e4479c4af31d44de1e09b590db7b5a0960d10 100644 (file)
--- a/src/tcpconns.c
+++ b/src/tcpconns.c
if (((port_collect_listening != 0) && (pe->flags & PORT_IS_LISTENING)) ||
(pe->flags & PORT_COLLECT_LOCAL)) {
- ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance),
+ snprintf(vl.plugin_instance, sizeof(vl.plugin_instance),
"%" PRIu16 "-local", pe->port);
for (int i = 1; i <= TCP_STATE_MAX; i++) {
}
if (pe->flags & PORT_COLLECT_REMOTE) {
- ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance),
+ snprintf(vl.plugin_instance, sizeof(vl.plugin_instance),
"%" PRIu16 "-remote", pe->port);
for (int i = 1; i <= TCP_STATE_MAX; i++) {
diff --git a/src/teamspeak2.c b/src/teamspeak2.c
index a26d16e36caa90b62cf2e1cbf97e3315f9ec9f4a..12c275329708035e63e4d19de0028db2cd09563a 100644 (file)
--- a/src/teamspeak2.c
+++ b/src/teamspeak2.c
int status;
/* Send request */
- ssnprintf(command, sizeof(command), "sel %i\r\n", vserver->port);
+ snprintf(command, sizeof(command), "sel %i\r\n", vserver->port);
status = tss2_send_request(write_fh, command);
if (status != 0) {
status = tss2_send_request(write_fh, "gi\r\n");
} else {
/* Request server information */
- ssnprintf(plugin_instance, sizeof(plugin_instance), "vserver%i",
+ snprintf(plugin_instance, sizeof(plugin_instance), "vserver%i",
vserver->port);
/* Select the server */
diff --git a/src/thermal.c b/src/thermal.c
index 48157552eed1dff67d7b9a8c9d0388b7f0b05126..456ae879d28527050c01018de988c4e9774a99bd 100644 (file)
--- a/src/thermal.c
+++ b/src/thermal.c
if (device_list && ignorelist_match(device_list, name))
return -1;
- ssnprintf(filename, sizeof(filename), "%s/%s/temp", dirname_sysfs, name);
+ snprintf(filename, sizeof(filename), "%s/%s/temp", dirname_sysfs, name);
if (parse_value_file(filename, &value, DS_TYPE_GAUGE) == 0) {
value.gauge /= 1000.0;
thermal_submit(name, TEMP, value);
success = 1;
}
- ssnprintf(filename, sizeof(filename), "%s/%s/cur_state", dirname_sysfs, name);
+ snprintf(filename, sizeof(filename), "%s/%s/cur_state", dirname_sysfs, name);
if (parse_value_file(filename, &value, DS_TYPE_GAUGE) == 0) {
thermal_submit(name, COOLING_DEV, value);
success = 1;
* temperature: 55 C
*/
- len = ssnprintf(filename, sizeof(filename), "%s/%s/temperature",
+ len = snprintf(filename, sizeof(filename), "%s/%s/temperature",
dirname_procfs, name);
if ((len < 0) || ((size_t)len >= sizeof(filename)))
return -1;
diff --git a/src/threshold.c b/src/threshold.c
index 72e922e90583b0e5ba2dfce2191800f3b11f06e5..f2407d2875579bc89a95ae236c01a58d3c213118 100644 (file)
--- a/src/threshold.c
+++ b/src/threshold.c
n.time = vl->time;
- status = ssnprintf(buf, bufsize, "Host %s, plugin %s", vl->host, vl->plugin);
+ status = snprintf(buf, bufsize, "Host %s, plugin %s", vl->host, vl->plugin);
buf += status;
bufsize -= status;
if (vl->plugin_instance[0] != '\0') {
- status = ssnprintf(buf, bufsize, " (instance %s)", vl->plugin_instance);
+ status = snprintf(buf, bufsize, " (instance %s)", vl->plugin_instance);
buf += status;
bufsize -= status;
}
- status = ssnprintf(buf, bufsize, " type %s", vl->type);
+ status = snprintf(buf, bufsize, " type %s", vl->type);
buf += status;
bufsize -= status;
if (vl->type_instance[0] != '\0') {
- status = ssnprintf(buf, bufsize, " (instance %s)", vl->type_instance);
+ status = snprintf(buf, bufsize, " (instance %s)", vl->type_instance);
buf += status;
bufsize -= status;
}
/* Send an okay notification */
if (state == STATE_OKAY) {
if (state_old == STATE_MISSING)
- ssnprintf(buf, bufsize, ": Value is no longer missing.");
+ snprintf(buf, bufsize, ": Value is no longer missing.");
else
- ssnprintf(buf, bufsize, ": All data sources are within range again. "
+ snprintf(buf, bufsize, ": All data sources are within range again. "
"Current value of \"%s\" is %f.",
ds->ds[ds_index].name, values[ds_index]);
} else {
if (th->flags & UT_FLAG_INVERT) {
if (!isnan(min) && !isnan(max)) {
- ssnprintf(buf, bufsize,
+ snprintf(buf, bufsize,
": Data source \"%s\" is currently "
"%f. That is within the %s region of %f%s and %f%s.",
ds->ds[ds_index].name, values[ds_index],
((th->flags & UT_FLAG_PERCENTAGE) != 0) ? "%" : "", max,
((th->flags & UT_FLAG_PERCENTAGE) != 0) ? "%" : "");
} else {
- ssnprintf(buf, bufsize, ": Data source \"%s\" is currently "
+ snprintf(buf, bufsize, ": Data source \"%s\" is currently "
"%f. That is %s the %s threshold of %f%s.",
ds->ds[ds_index].name, values[ds_index],
isnan(min) ? "below" : "above",
else
value = 100.0 * values[ds_index] / sum;
- ssnprintf(buf, bufsize,
+ snprintf(buf, bufsize,
": Data source \"%s\" is currently "
"%g (%.2f%%). That is %s the %s threshold of %.2f%%.",
ds->ds[ds_index].name, values[ds_index], value,
(value < min) ? min : max);
} else /* is not inverted */
{
- ssnprintf(buf, bufsize, ": Data source \"%s\" is currently "
+ snprintf(buf, bufsize, ": Data source \"%s\" is currently "
"%f. That is %s the %s threshold of %f.",
ds->ds[ds_index].name, values[ds_index],
(values[ds_index] < min) ? "below" : "above",
FORMAT_VL(identifier, sizeof(identifier), vl);
NOTIFICATION_INIT_VL(&n, vl);
- ssnprintf(n.message, sizeof(n.message),
+ snprintf(n.message, sizeof(n.message),
"%s has not been updated for %.3f seconds.", identifier,
CDTIME_T_TO_DOUBLE(missing_time));
n.time = now;
diff --git a/src/turbostat.c b/src/turbostat.c
index 45c8bd704537206ae78058186b589dba09e3d0ea..73a6769be44a80a75786fa8b99fdddefe0e4e39e 100644 (file)
--- a/src/turbostat.c
+++ b/src/turbostat.c
}
}
- ssnprintf(pathname, sizeof(pathname), "/dev/cpu/%d/msr", cpu);
+ snprintf(pathname, sizeof(pathname), "/dev/cpu/%d/msr", cpu);
fd = open(pathname, O_RDONLY);
if (fd < 0) {
ERROR("turbostat plugin: failed to open %s", pathname);
DEBUG("turbostat plugin: submit stats for cpu: %d, core: %d, pkg: %d",
t->cpu_id, c->core_id, p->package_id);
- ssnprintf(name, sizeof(name), "cpu%02d", t->cpu_id);
+ snprintf(name, sizeof(name), "cpu%02d", t->cpu_id);
if (!aperf_mperf_unstable)
turbostat_submit(name, "percent", "c0", 100.0 * t->mperf / t->tsc);
/* If not using logical core numbering, set core id */
if (!config_lcn) {
- ssnprintf(name, sizeof(name), "core%02d", c->core_id);
+ snprintf(name, sizeof(name), "core%02d", c->core_id);
}
if (do_core_cstate & (1 << 3))
if (!(t->flags & CPU_IS_FIRST_CORE_IN_PACKAGE))
goto done;
- ssnprintf(name, sizeof(name), "pkg%02d", p->package_id);
+ snprintf(name, sizeof(name), "pkg%02d", p->package_id);
if (do_ptm)
turbostat_submit(name, "temperature", NULL, p->pkg_temp_c);
int matches;
char character;
- ssnprintf(path, sizeof(path),
+ snprintf(path, sizeof(path),
"/sys/devices/system/cpu/cpu%d/topology/thread_siblings_list", cpu);
filep = fopen(path, "r");
if (!filep) {
diff --git a/src/utils_cmd_putval.c b/src/utils_cmd_putval.c
index 718425b08eb5bf66fdc5c93596c9f0fa8b8e48b2..aadc214e2ac845277c7e633b54df0f8d1f1000c8 100644 (file)
--- a/src/utils_cmd_putval.c
+++ b/src/utils_cmd_putval.c
return status;
escape_string(buffer_values, sizeof(buffer_values));
- ssnprintf(ret, ret_len, "PUTVAL %s interval=%.3f %s", buffer_ident,
+ snprintf(ret, ret_len, "PUTVAL %s interval=%.3f %s", buffer_ident,
(vl->interval > 0) ? CDTIME_T_TO_DOUBLE(vl->interval)
: CDTIME_T_TO_DOUBLE(plugin_get_interval()),
buffer_values);
diff --git a/src/utils_dns.c b/src/utils_dns.c
index 37fa930ff6c029a7f6d7aac8dbbb8917a53d8ede..e7e04f7c0be835379e31a8461526c8662ac354e8 100644 (file)
--- a/src/utils_dns.c
+++ b/src/utils_dns.c
return "ANY"; /* ... 255 */
#endif /* __BIND >= 19950621 */
default:
- ssnprintf(buf, sizeof(buf), "#%i", t);
+ snprintf(buf, sizeof(buf), "#%i", t);
return buf;
} /* switch (t) */
}
case 5:
return "Update";
default:
- ssnprintf(buf, sizeof(buf), "Opcode%d", o);
+ snprintf(buf, sizeof(buf), "Opcode%d", o);
return buf;
}
}
#endif /* RFC2136 rcodes */
#endif /* __BIND >= 19950621 */
default:
- ssnprintf(buf, sizeof(buf), "RCode%i", rcode);
+ snprintf(buf, sizeof(buf), "RCode%i", rcode);
return buf;
}
} /* const char *rcode_str (int rcode) */
diff --git a/src/utils_dpdk.c b/src/utils_dpdk.c
index 3a30438d5c170eff371a9cd787883fd741c131da..4911c80920d461931f5a937387afe961cace0d4d 100644 (file)
--- a/src/utils_dpdk.c
+++ b/src/utils_dpdk.c
DPDK_HELPER_TRACE(phc->shm_name);
- ssnprintf(phc->eal_config.coremask, DATA_MAX_NAME_LEN, "%s", "0xf");
- ssnprintf(phc->eal_config.memory_channels, DATA_MAX_NAME_LEN, "%s", "1");
- ssnprintf(phc->eal_config.process_type, DATA_MAX_NAME_LEN, "%s", "secondary");
- ssnprintf(phc->eal_config.file_prefix, DATA_MAX_NAME_LEN, "%s",
+ snprintf(phc->eal_config.coremask, DATA_MAX_NAME_LEN, "%s", "0xf");
+ snprintf(phc->eal_config.memory_channels, DATA_MAX_NAME_LEN, "%s", "1");
+ snprintf(phc->eal_config.process_type, DATA_MAX_NAME_LEN, "%s", "secondary");
+ snprintf(phc->eal_config.file_prefix, DATA_MAX_NAME_LEN, "%s",
DPDK_DEFAULT_RTE_CONFIG);
}
DEBUG("dpdk_common: EAL:Process type %s", phc->eal_config.process_type);
} else if ((strcasecmp("FilePrefix", child->key) == 0) &&
(child->values[0].type == OCONFIG_TYPE_STRING)) {
- ssnprintf(phc->eal_config.file_prefix, DATA_MAX_NAME_LEN,
+ snprintf(phc->eal_config.file_prefix, DATA_MAX_NAME_LEN,
"/var/run/.%s_config", child->values[0].value.string);
DEBUG("dpdk_common: EAL:File prefix %s", phc->eal_config.file_prefix);
} else {
index f124ba10cf5fd2511ac957c73ac98754e5046a47..a247f28b048f0e8f06cfdeef5e6d66c5f955acf6 100644 (file)
#define BUFFER_ADD(...) \
do { \
- status = ssnprintf(ret + offset, ret_len - offset, __VA_ARGS__); \
+ status = snprintf(ret + offset, ret_len - offset, __VA_ARGS__); \
if (status < 1) { \
return -1; \
} else if (((size_t)status) >= (ret_len - offset)) { \
sizeof(n_type_instance), escape_char, preserve_separator);
if (n_plugin_instance[0] != '\0')
- ssnprintf(tmp_plugin, sizeof(tmp_plugin), "%s%c%s", n_plugin,
+ snprintf(tmp_plugin, sizeof(tmp_plugin), "%s%c%s", n_plugin,
(flags & GRAPHITE_SEPARATE_INSTANCES) ? '.' : '-',
n_plugin_instance);
else
if ((flags & GRAPHITE_DROP_DUPE_FIELDS) && strcmp(n_plugin, n_type) == 0)
sstrncpy(tmp_type, n_type_instance, sizeof(tmp_type));
else
- ssnprintf(tmp_type, sizeof(tmp_type), "%s%c%s", n_type,
+ snprintf(tmp_type, sizeof(tmp_type), "%s%c%s", n_type,
(flags & GRAPHITE_SEPARATE_INSTANCES) ? '.' : '-',
n_type_instance);
} else
if (ds_name != NULL) {
if ((flags & GRAPHITE_DROP_DUPE_FIELDS) &&
strcmp(tmp_plugin, tmp_type) == 0)
- ssnprintf(ret, ret_len, "%s%s%s.%s.%s", prefix, n_host, postfix,
+ snprintf(ret, ret_len, "%s%s%s.%s.%s", prefix, n_host, postfix,
tmp_plugin, ds_name);
else
- ssnprintf(ret, ret_len, "%s%s%s.%s.%s.%s", prefix, n_host, postfix,
+ snprintf(ret, ret_len, "%s%s%s.%s.%s.%s", prefix, n_host, postfix,
tmp_plugin, tmp_type, ds_name);
} else
- ssnprintf(ret, ret_len, "%s%s%s.%s.%s", prefix, n_host, postfix, tmp_plugin,
+ snprintf(ret, ret_len, "%s%s%s.%s.%s", prefix, n_host, postfix, tmp_plugin,
tmp_type);
return 0;
/* Compute the graphite command */
message_len =
- (size_t)ssnprintf(message, sizeof(message), "%s %s %u\r\n", key, values,
+ (size_t)snprintf(message, sizeof(message), "%s %s %u\r\n", key, values,
(unsigned int)CDTIME_T_TO_TIME_T(vl->time));
if (message_len >= sizeof(message)) {
ERROR("format_graphite: message buffer too small: "
index 67aebbaf8e0cb103890a6ce3b8b9d04f10b73c1d..d685390d3f953f841eb28d81be89a523d011412b 100644 (file)
--- a/src/utils_format_json.c
+++ b/src/utils_format_json.c
#define BUFFER_ADD(...) \
do { \
int status; \
- status = ssnprintf(buffer + offset, buffer_size - offset, __VA_ARGS__); \
+ status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__); \
if (status < 1) { \
sfree(rates); \
return -1; \
#define BUFFER_ADD(...) \
do { \
int status; \
- status = ssnprintf(buffer + offset, buffer_size - offset, __VA_ARGS__); \
+ status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__); \
if (status < 1) \
return -1; \
else if (((size_t)status) >= (buffer_size - offset)) \
#define BUFFER_ADD(...) \
do { \
int status; \
- status = ssnprintf(buffer + offset, buffer_size - offset, __VA_ARGS__); \
+ status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__); \
if (status < 1) \
return -1; \
else if (((size_t)status) >= (buffer_size - offset)) \
#define BUFFER_ADD(...) \
do { \
- status = ssnprintf(buffer + offset, buffer_size - offset, __VA_ARGS__); \
+ status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__); \
if (status < 1) \
return -1; \
else if (((size_t)status) >= (buffer_size - offset)) \
#define BUFFER_ADD(...) \
do { \
- status = ssnprintf(buffer + offset, buffer_size - offset, __VA_ARGS__); \
+ status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__); \
if (status < 1) \
return -1; \
else if (((size_t)status) >= (buffer_size - offset)) \
index 4378d7ffe0793bec2577f251653576a67ace1c16..b344d183b3ac349192bfe80bb6c03e34575eae6f 100644 (file)
#define BUFFER_ADD(...) \
do { \
int status; \
- status = ssnprintf(buffer + offset, buffer_size - offset, __VA_ARGS__); \
+ status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__); \
if (status < 1) { \
sfree(rates); \
return -1; \
#define BUFFER_ADD(...) \
do { \
- status = ssnprintf(buffer + offset, buffer_size - offset, __VA_ARGS__); \
+ status = snprintf(buffer + offset, buffer_size - offset, __VA_ARGS__); \
if (status < 1) \
return -1; \
else if (((size_t)status) >= (buffer_size - offset)) \
diff --git a/src/utils_mount.c b/src/utils_mount.c
index bbc4c209dcf8a3c6b201bbfce35798fd4ee5c1e3..e5ddcaf890e97d70a99814005acff2e3a95f262e 100644 (file)
--- a/src/utils_mount.c
+++ b/src/utils_mount.c
* (This is useful, if the cdrom on /dev/hdc must not
* be accessed.)
*/
- ssnprintf(device, sizeof(device), "%s/%s", DEVLABELDIR, ptname);
+ snprintf(device, sizeof(device), "%s/%s", DEVLABELDIR, ptname);
if (!get_label_uuid(device, &label, uuid)) {
uuidcache_addentry(sstrdup(device), label, uuid);
}
diff --git a/src/utils_ovs.c b/src/utils_ovs.c
index 2f7baea00129df218df3e8bf1cdce29d1a36d686..67b9f8f0d54a9cc5aa574c5e2c38bf159182f75a 100644 (file)
--- a/src/utils_ovs.c
+++ b/src/utils_ovs.c
@@ -1091,7 +1091,7 @@ int ovs_db_send_request(ovs_db_t *pdb, const char *method, const char *params,
/* generate id field */
OVS_YAJL_CALL(ovs_yajl_gen_tstring, jgen, "id");
uid = ovs_uid_generate();
- ssnprintf(uid_buff, sizeof(uid_buff), "%" PRIX64, uid);
+ snprintf(uid_buff, sizeof(uid_buff), "%" PRIX64, uid);
OVS_YAJL_CALL(ovs_yajl_gen_tstring, jgen, uid_buff);
OVS_YAJL_CALL(yajl_gen_map_close, jgen);
OVS_YAJL_CALL(ovs_yajl_gen_tstring, jgen, OVS_DB_DEFAULT_DB_NAME);
/* uid string <json-value> */
- ssnprintf(uid_str, sizeof(uid_str), "%" PRIX64, new_cb->uid);
+ snprintf(uid_str, sizeof(uid_str), "%" PRIX64, new_cb->uid);
OVS_YAJL_CALL(ovs_yajl_gen_tstring, jgen, uid_str);
/* <monitor-requests> */
diff --git a/src/utils_rrdcreate.c b/src/utils_rrdcreate.c
index 86f7f3fbaace5f9929929a1471e8c342669e4511..1448cc5119eda7aacb28b170fbd45b64407ad9a7 100644 (file)
--- a/src/utils_rrdcreate.c
+++ b/src/utils_rrdcreate.c
if (rra_num >= rra_max)
break;
- status = ssnprintf(buffer, sizeof(buffer), "RRA:%s:%.10f:%u:%u",
+ 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))) {
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,
+ 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),
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);
diff --git a/src/utils_tail_match.c b/src/utils_tail_match.c
index f046f6b1e8d64c547651d6bbee5ff8a942b031cc..a3f0ec11caeb57c32ea1d7e5084d8dd24283738f 100644 (file)
--- a/src/utils_tail_match.c
+++ b/src/utils_tail_match.c
sstrncpy(vl.type, data->type, sizeof(vl.type));
for (size_t i = 0; i < data->latency_config.percentile_num; i++) {
if (strlen(data->type_instance) != 0)
- ssnprintf(vl.type_instance, sizeof(vl.type_instance), "%s-%.0f",
+ snprintf(vl.type_instance, sizeof(vl.type_instance), "%s-%.0f",
data->type_instance, data->latency_config.percentile[i]);
else
- ssnprintf(vl.type_instance, sizeof(vl.type_instance), "%.0f",
+ snprintf(vl.type_instance, sizeof(vl.type_instance), "%.0f",
data->latency_config.percentile[i]);
vl.values = &(value_t){
bucket.upper_bound ? CDTIME_T_TO_DOUBLE(bucket.upper_bound) : INFINITY;
if (strlen(data->type_instance) != 0)
- ssnprintf(vl.type_instance, sizeof(vl.type_instance), "%s-%s-%g_%g",
+ snprintf(vl.type_instance, sizeof(vl.type_instance), "%s-%s-%g_%g",
data->type, data->type_instance, lower_bound, upper_bound);
else
- ssnprintf(vl.type_instance, sizeof(vl.type_instance), "%s-%g_%g",
+ snprintf(vl.type_instance, sizeof(vl.type_instance), "%s-%g_%g",
data->type, lower_bound, upper_bound);
vl.values = &(value_t){
diff --git a/src/varnish.c b/src/varnish.c
index 1a71d8ce5e42b40987ee7ce49959d87f10df476c..90dd4e943ad30dd46c04959d9eef023eaf46b572 100644 (file)
--- a/src/varnish.c
+++ b/src/varnish.c
if (plugin_instance == NULL)
plugin_instance = "default";
- ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s-%s",
+ snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%s-%s",
plugin_instance, category);
sstrncpy(vl.type, type, sizeof(vl.type));
return EINVAL;
}
- ssnprintf(callback_name, sizeof(callback_name), "varnish/%s",
+ snprintf(callback_name, sizeof(callback_name), "varnish/%s",
(conf->instance == NULL) ? "localhost" : conf->instance);
plugin_register_complex_read(
diff --git a/src/virt.c b/src/virt.c
index 14095df45a68cba8c8b8497cbceece8901e0a15c..b3e34f4ec4b9d66d30124162ae0177182678c708 100644 (file)
--- a/src/virt.c
+++ b/src/virt.c
const char *type) {
char type_instance[DATA_MAX_NAME_LEN];
- ssnprintf(type_instance, sizeof(type_instance), "%d", vcpu_nr);
+ snprintf(type_instance, sizeof(type_instance), "%d", vcpu_nr);
submit(dom, type, type_instance, &(value_t){.derive = value}, 1);
}
}
char flush_type_instance[DATA_MAX_NAME_LEN];
- ssnprintf(flush_type_instance, sizeof(flush_type_instance), "flush-%s",
+ snprintf(flush_type_instance, sizeof(flush_type_instance), "flush-%s",
type_instance);
if ((binfo->bi.rd_req != -1) && (binfo->bi.wr_req != -1))
const char *reason_str = "N/A";
#endif
- ssnprintf(msg, sizeof(msg), "Domain state: %s. Reason: %s", state_str,
+ snprintf(msg, sizeof(msg), "Domain state: %s. Reason: %s", state_str,
reason_str);
int severity;
char type_instance[DATA_MAX_NAME_LEN];
_Bool is_set = VIR_CPU_USABLE(cpu_maps, cpu_map_len, vcpu, cpu) ? 1 : 0;
- ssnprintf(type_instance, sizeof(type_instance), "vcpu_%d-cpu_%d", vcpu,
+ snprintf(type_instance, sizeof(type_instance), "vcpu_%d-cpu_%d", vcpu,
cpu);
submit(dom, "cpu_affinity", type_instance, &(value_t){.gauge = is_set}, 1);
}
memset(lv_ud, 0, sizeof(*lv_ud));
- ssnprintf(inst->tag, sizeof(inst->tag), "%s-%zu", PLUGIN_NAME, i);
+ snprintf(inst->tag, sizeof(inst->tag), "%s-%zu", PLUGIN_NAME, i);
inst->id = i;
user_data_t *ud = &(lv_ud->ud);
@@ -1721,7 +1721,7 @@ static int lv_domain_get_tag(xmlXPathContextPtr xpath_ctx, const char *dom_name,
goto done;
}
- ssnprintf(xpath_str, sizeof(xpath_str), "/domain/metadata/%s:%s/text()",
+ snprintf(xpath_str, sizeof(xpath_str), "/domain/metadata/%s:%s/text()",
METADATA_VM_PARTITION_PREFIX, METADATA_VM_PARTITION_ELEMENT);
xpath_obj = xmlXPathEvalExpression((xmlChar *)xpath_str, xpath_ctx);
if (xpath_obj == NULL) {
ERROR(PLUGIN_NAME " plugin: malloc failed.");
return 0;
}
- ssnprintf(name, n, "%s:%s", domname, devpath);
+ snprintf(name, n, "%s:%s", domname, devpath);
r = ignorelist_match(il, name);
sfree(name);
return r;
diff --git a/src/vserver.c b/src/vserver.c
index a2ca0de5dfc93109b2a4fa79d4a673b0792ede6b..6f9d46bfe12c33691342f04e7113615ea40d7087 100644 (file)
--- a/src/vserver.c
+++ b/src/vserver.c
if (dent->d_name[0] == '.')
continue;
- len = ssnprintf(file, sizeof(file), PROCDIR "/%s", dent->d_name);
+ len = snprintf(file, sizeof(file), PROCDIR "/%s", dent->d_name);
if ((len < 0) || (len >= BUFSIZE))
continue;
continue;
/* socket message accounting */
- len = ssnprintf(file, sizeof(file), PROCDIR "/%s/cacct", dent->d_name);
+ len = snprintf(file, sizeof(file), PROCDIR "/%s/cacct", dent->d_name);
if ((len < 0) || ((size_t)len >= sizeof(file)))
continue;
}
/* thread information and load */
- len = ssnprintf(file, sizeof(file), PROCDIR "/%s/cvirt", dent->d_name);
+ len = snprintf(file, sizeof(file), PROCDIR "/%s/cvirt", dent->d_name);
if ((len < 0) || ((size_t)len >= sizeof(file)))
continue;
}
/* processes and memory usage */
- len = ssnprintf(file, sizeof(file), PROCDIR "/%s/limit", dent->d_name);
+ len = snprintf(file, sizeof(file), PROCDIR "/%s/limit", dent->d_name);
if ((len < 0) || ((size_t)len >= sizeof(file)))
continue;
diff --git a/src/write_graphite.c b/src/write_graphite.c
index 206cdc2d9fc94f66a39fbb884541a76ee011d518..8fbb715cae8d54c51bf7c27195d815c965edb085 100644 (file)
--- a/src/write_graphite.c
+++ b/src/write_graphite.c
/* FIXME: Legacy configuration syntax. */
if (cb->name == NULL)
- ssnprintf(callback_name, sizeof(callback_name), "write_graphite/%s/%s/%s",
+ snprintf(callback_name, sizeof(callback_name), "write_graphite/%s/%s/%s",
cb->node, cb->service, cb->protocol);
else
- ssnprintf(callback_name, sizeof(callback_name), "write_graphite/%s",
+ snprintf(callback_name, sizeof(callback_name), "write_graphite/%s",
cb->name);
plugin_register_write(callback_name, wg_write,
diff --git a/src/write_http.c b/src/write_http.c
index d5c91d910e8efbd5abadeb8233d24803cca1269d..1c270bdf886c72fbe091885edb761df07ab29a16 100644 (file)
--- a/src/write_http.c
+++ b/src/write_http.c
return -1;
}
- ssnprintf(cb->credentials, credentials_size, "%s:%s", cb->user,
+ snprintf(cb->credentials, credentials_size, "%s:%s", cb->user,
(cb->pass == NULL) ? "" : cb->pass);
curl_easy_setopt(cb->curl, CURLOPT_USERPWD, cb->credentials);
#endif
return status;
}
- command_len = (size_t)ssnprintf(command, sizeof(command),
+ command_len = (size_t)snprintf(command, sizeof(command),
"PUTVAL %s interval=%.3f %s\r\n", key,
CDTIME_T_TO_DOUBLE(vl->interval), values);
if (command_len >= sizeof(command)) {
/* Nulls the buffer and sets ..._free and ..._fill. */
wh_reset_buffer(cb);
- ssnprintf(callback_name, sizeof(callback_name), "write_http/%s", cb->name);
+ snprintf(callback_name, sizeof(callback_name), "write_http/%s", cb->name);
DEBUG("write_http: Registering write callback '%s' with URL '%s'",
callback_name, cb->location);
diff --git a/src/write_kafka.c b/src/write_kafka.c
index ca400acbff85348045f76477562bffd4e245cae2..b1c8bf94a2a716184797434e6c157ecf6fb6a2d3 100644 (file)
--- a/src/write_kafka.c
+++ b/src/write_kafka.c
#define KAFKA_RANDOM_KEY_BUFFER \
(char[KAFKA_RANDOM_KEY_SIZE]) { "" }
static char *kafka_random_key(char buffer[static KAFKA_RANDOM_KEY_SIZE]) {
- ssnprintf(buffer, KAFKA_RANDOM_KEY_SIZE, "%08" PRIX32, cdrand_u());
+ snprintf(buffer, KAFKA_RANDOM_KEY_SIZE, "%08" PRIX32, cdrand_u());
return buffer;
}
rd_kafka_topic_conf_set_partitioner_cb(tctx->conf, kafka_partition);
rd_kafka_topic_conf_set_opaque(tctx->conf, tctx);
- ssnprintf(callback_name, sizeof(callback_name), "write_kafka/%s",
+ snprintf(callback_name, sizeof(callback_name), "write_kafka/%s",
tctx->topic_name);
status = plugin_register_write(
diff --git a/src/write_mongodb.c b/src/write_mongodb.c
index e90900ec12f8cf2c3f53fbed2830ea97d191ab42..2cb4537ba043bcff633a212752a9e46bf7f4bbab 100644 (file)
--- a/src/write_mongodb.c
+++ b/src/write_mongodb.c
for (int i = 0; i < ds->ds_num; i++) {
char key[16];
- ssnprintf(key, sizeof(key), "%i", i);
+ snprintf(key, sizeof(key), "%i", i);
if (ds->ds[i].type == DS_TYPE_GAUGE)
BSON_APPEND_DOUBLE(&subarray, key, vl->values[i].gauge);
for (int i = 0; i < ds->ds_num; i++) {
char key[16];
- ssnprintf(key, sizeof(key), "%i", i);
+ snprintf(key, sizeof(key), "%i", i);
if (store_rates)
BSON_APPEND_UTF8(&subarray, key, "gauge");
for (int i = 0; i < ds->ds_num; i++) {
char key[16];
- ssnprintf(key, sizeof(key), "%i", i);
+ snprintf(key, sizeof(key), "%i", i);
BSON_APPEND_UTF8(&subarray, key, ds->ds[i].name);
}
bson_append_array_end(ret, &subarray); /* }}} dsnames */
if (status == 0) {
char cb_name[DATA_MAX_NAME_LEN];
- ssnprintf(cb_name, sizeof(cb_name), "write_mongodb/%s", node->name);
+ snprintf(cb_name, sizeof(cb_name), "write_mongodb/%s", node->name);
status =
plugin_register_write(cb_name, wm_write,
diff --git a/src/write_prometheus.c b/src/write_prometheus.c
index 526499849c2f27a5040f8d8b7febc00a107c9494..325a6c68d76d492ec210483af3e7d650e53d7844 100644 (file)
--- a/src/write_prometheus.c
+++ b/src/write_prometheus.c
* know that they are sane. */
for (size_t i = 0; i < m->n_label; i++) {
char value[LABEL_VALUE_SIZE];
- ssnprintf(labels[i], LABEL_BUFFER_SIZE, "%s=\"%s\"", m->label[i]->name,
+ snprintf(labels[i], LABEL_BUFFER_SIZE, "%s=\"%s\"", m->label[i]->name,
escape_label_value(value, sizeof(value), m->label[i]->value));
}
while (c_avl_iterator_next(iter, (void *)&unused_name, (void *)&fam) == 0) {
char line[1024]; /* 4x DATA_MAX_NAME_LEN? */
- ssnprintf(line, sizeof(line), "# HELP %s %s\n", fam->name, fam->help);
+ snprintf(line, sizeof(line), "# HELP %s %s\n", fam->name, fam->help);
buffer->append(buffer, strlen(line), (uint8_t *)line);
- ssnprintf(line, sizeof(line), "# TYPE %s %s\n", fam->name,
+ snprintf(line, sizeof(line), "# TYPE %s %s\n", fam->name,
(fam->type == IO__PROMETHEUS__CLIENT__METRIC_TYPE__GAUGE)
? "gauge"
: "counter");
char timestamp_ms[24] = "";
if (m->has_timestamp_ms)
- ssnprintf(timestamp_ms, sizeof(timestamp_ms), " %" PRIi64,
+ snprintf(timestamp_ms, sizeof(timestamp_ms), " %" PRIi64,
m->timestamp_ms);
if (fam->type == IO__PROMETHEUS__CLIENT__METRIC_TYPE__GAUGE)
- ssnprintf(line, sizeof(line), "%s{%s} " GAUGE_FORMAT "%s\n", fam->name,
+ snprintf(line, sizeof(line), "%s{%s} " GAUGE_FORMAT "%s\n", fam->name,
format_labels(labels, sizeof(labels), m), m->gauge->value,
timestamp_ms);
else /* if (fam->type == IO__PROMETHEUS__CLIENT__METRIC_TYPE__COUNTER) */
- ssnprintf(line, sizeof(line), "%s{%s} %.0f%s\n", fam->name,
+ snprintf(line, sizeof(line), "%s{%s} %.0f%s\n", fam->name,
format_labels(labels, sizeof(labels), m), m->counter->value,
timestamp_ms);
c_avl_iterator_destroy(iter);
char server[1024];
- ssnprintf(server, sizeof(server), "\n# collectd/write_prometheus %s at %s\n",
+ snprintf(server, sizeof(server), "\n# collectd/write_prometheus %s at %s\n",
PACKAGE_VERSION, hostname_g);
buffer->append(buffer, strlen(server), (uint8_t *)server);
msg->name = name;
char help[1024];
- ssnprintf(
+ snprintf(
help, sizeof(help),
"write_prometheus plugin: '%s' Type: '%s', Dstype: '%s', Dsname: '%s'",
vl->plugin, vl->type, DS_TYPE_TO_STRING(ds->ds[ds_index].type),
diff --git a/src/write_redis.c b/src/write_redis.c
index f7215b50dbfaaadf38a2f6ff4c9f60d240b0fade..7d383f95ef5367d9675042decd580da89402af1e 100644 (file)
--- a/src/write_redis.c
+++ b/src/write_redis.c
status = FORMAT_VL(ident, sizeof(ident), vl);
if (status != 0)
return status;
- ssnprintf(key, sizeof(key), "%s%s",
+ snprintf(key, sizeof(key), "%s%s",
(node->prefix != NULL) ? node->prefix : REDIS_DEFAULT_PREFIX,
ident);
- ssnprintf(time, sizeof(time), "%.9f", CDTIME_T_TO_DOUBLE(vl->time));
+ snprintf(time, sizeof(time), "%.9f", CDTIME_T_TO_DOUBLE(vl->time));
value_size = sizeof(value);
value_ptr = &value[0];
if (status == 0) {
char cb_name[DATA_MAX_NAME_LEN];
- ssnprintf(cb_name, sizeof(cb_name), "write_redis/%s", node->name);
+ snprintf(cb_name, sizeof(cb_name), "write_redis/%s", node->name);
status = plugin_register_write(
cb_name, wr_write, &(user_data_t){
diff --git a/src/write_riemann.c b/src/write_riemann.c
index 5bd0cf433bd3899e1c23517a2804c56dfd07e2b2..488b482171bb5150fa60a299feee4019e45d7d3e 100644 (file)
--- a/src/write_riemann.c
+++ b/src/write_riemann.c
vl->type_instance);
if (host->always_append_ds || (ds->ds_num > 1)) {
if (host->event_service_prefix == NULL)
- ssnprintf(service_buffer, sizeof(service_buffer), "%s/%s",
+ snprintf(service_buffer, sizeof(service_buffer), "%s/%s",
&name_buffer[1], ds->ds[index].name);
else
- ssnprintf(service_buffer, sizeof(service_buffer), "%s%s/%s",
+ snprintf(service_buffer, sizeof(service_buffer), "%s%s/%s",
host->event_service_prefix, &name_buffer[1],
ds->ds[index].name);
} else {
if (host->event_service_prefix == NULL)
sstrncpy(service_buffer, &name_buffer[1], sizeof(service_buffer));
else
- ssnprintf(service_buffer, sizeof(service_buffer), "%s%s",
+ snprintf(service_buffer, sizeof(service_buffer), "%s%s",
host->event_service_prefix, &name_buffer[1]);
}
if ((ds->ds[index].type != DS_TYPE_GAUGE) && (rates != NULL)) {
char ds_type[DATA_MAX_NAME_LEN];
- ssnprintf(ds_type, sizeof(ds_type), "%s:rate",
+ snprintf(ds_type, sizeof(ds_type), "%s:rate",
DS_TYPE_TO_STRING(ds->ds[index].type));
riemann_event_string_attribute_add(event, "ds_type", ds_type);
} else {
{
char ds_index[DATA_MAX_NAME_LEN];
- ssnprintf(ds_index, sizeof(ds_index), "%zu", index);
+ snprintf(ds_index, sizeof(ds_index), "%zu", index);
riemann_event_string_attribute_add(event, "ds_index", ds_index);
}
return status;
}
- ssnprintf(callback_name, sizeof(callback_name), "write_riemann/%s",
+ snprintf(callback_name, sizeof(callback_name), "write_riemann/%s",
host->name);
user_data_t ud = {.data = host, .free_func = wrr_free};
diff --git a/src/write_sensu.c b/src/write_sensu.c
index 56acb638b016abceb679d9ba56e0ae1abbb2d6c3..51f962202df42e3e8db0aeebdacee064911124bb 100644 (file)
--- a/src/write_sensu.c
+++ b/src/write_sensu.c
// incorporate the data source type
if ((ds->ds[index].type != DS_TYPE_GAUGE) && (rates != NULL)) {
char ds_type[DATA_MAX_NAME_LEN];
- ssnprintf(ds_type, sizeof(ds_type), "%s:rate",
+ snprintf(ds_type, sizeof(ds_type), "%s:rate",
DS_TYPE_TO_STRING(ds->ds[index].type));
res = my_asprintf(&temp_str, "%s, \"collectd_data_source_type\": \"%s\"",
ret_str, ds_type);
// incorporate the data source index
{
char ds_index[DATA_MAX_NAME_LEN];
- ssnprintf(ds_index, sizeof(ds_index), "%zu", index);
+ snprintf(ds_index, sizeof(ds_index), "%zu", index);
res = my_asprintf(&temp_str, "%s, \"collectd_data_source_index\": %s",
ret_str, ds_index);
free(ret_str);
host->separator);
if (host->always_append_ds || (ds->ds_num > 1)) {
if (host->event_service_prefix == NULL)
- ssnprintf(service_buffer, sizeof(service_buffer), "%s.%s", name_buffer,
+ snprintf(service_buffer, sizeof(service_buffer), "%s.%s", name_buffer,
ds->ds[index].name);
else
- ssnprintf(service_buffer, sizeof(service_buffer), "%s%s.%s",
+ snprintf(service_buffer, sizeof(service_buffer), "%s%s.%s",
host->event_service_prefix, name_buffer, ds->ds[index].name);
} else {
if (host->event_service_prefix == NULL)
sstrncpy(service_buffer, name_buffer, sizeof(service_buffer));
else
- ssnprintf(service_buffer, sizeof(service_buffer), "%s%s",
+ snprintf(service_buffer, sizeof(service_buffer), "%s%s",
host->event_service_prefix, name_buffer);
}
return -1;
}
- ssnprintf(callback_name, sizeof(callback_name), "write_sensu/%s", host->name);
+ snprintf(callback_name, sizeof(callback_name), "write_sensu/%s", host->name);
user_data_t ud = {.data = host, .free_func = sensu_free};
diff --git a/src/write_tsdb.c b/src/write_tsdb.c
index 1a1cd648eb6d0b8bb4a6324fb259bd1b5b2c2f79..0e469925b323163eaf60ee598af1ceda745e0142 100644 (file)
--- a/src/write_tsdb.c
+++ b/src/write_tsdb.c
#define BUFFER_ADD(...) \
do { \
- status = ssnprintf(ret + offset, ret_len - offset, __VA_ARGS__); \
+ status = snprintf(ret + offset, ret_len - offset, __VA_ARGS__); \
if (status < 1) { \
sfree(rates); \
return -1; \
if (ds_name != NULL) {
if (vl->plugin_instance[0] == '\0') {
if (vl->type_instance[0] == '\0') {
- ssnprintf(ret, ret_len, "%s%s.%s.%s", prefix, vl->plugin, vl->type,
+ snprintf(ret, ret_len, "%s%s.%s.%s", prefix, vl->plugin, vl->type,
ds_name);
} else {
- ssnprintf(ret, ret_len, "%s%s.%s.%s.%s", prefix, vl->plugin, vl->type,
+ snprintf(ret, ret_len, "%s%s.%s.%s.%s", prefix, vl->plugin, vl->type,
vl->type_instance, ds_name);
}
} else { /* vl->plugin_instance != "" */
if (vl->type_instance[0] == '\0') {
- ssnprintf(ret, ret_len, "%s%s.%s.%s.%s", prefix, vl->plugin,
+ snprintf(ret, ret_len, "%s%s.%s.%s.%s", prefix, vl->plugin,
vl->plugin_instance, vl->type, ds_name);
} else {
- ssnprintf(ret, ret_len, "%s%s.%s.%s.%s.%s", prefix, vl->plugin,
+ snprintf(ret, ret_len, "%s%s.%s.%s.%s.%s", prefix, vl->plugin,
vl->plugin_instance, vl->type, vl->type_instance, ds_name);
}
}
} else { /* ds_name == NULL */
if (vl->plugin_instance[0] == '\0') {
if (vl->type_instance[0] == '\0') {
- ssnprintf(ret, ret_len, "%s%s.%s", prefix, vl->plugin, vl->type);
+ snprintf(ret, ret_len, "%s%s.%s", prefix, vl->plugin, vl->type);
} else {
- ssnprintf(ret, ret_len, "%s%s.%s.%s", prefix, vl->plugin,
+ snprintf(ret, ret_len, "%s%s.%s.%s", prefix, vl->plugin,
vl->type_instance, vl->type);
}
} else { /* vl->plugin_instance != "" */
if (vl->type_instance[0] == '\0') {
- ssnprintf(ret, ret_len, "%s%s.%s.%s", prefix, vl->plugin,
+ snprintf(ret, ret_len, "%s%s.%s.%s", prefix, vl->plugin,
vl->plugin_instance, vl->type);
} else {
- ssnprintf(ret, ret_len, "%s%s.%s.%s.%s", prefix, vl->plugin,
+ snprintf(ret, ret_len, "%s%s.%s.%s.%s", prefix, vl->plugin,
vl->plugin_instance, vl->type, vl->type_instance);
}
}
}
status =
- ssnprintf(message, sizeof(message), "put %s %.0f %s fqdn=%s %s %s\r\n",
+ snprintf(message, sizeof(message), "put %s %.0f %s fqdn=%s %s %s\r\n",
key, CDTIME_T_TO_DOUBLE(time), value, host, tags, host_tags);
sfree(temp);
if (status < 0)
}
}
- ssnprintf(callback_name, sizeof(callback_name), "write_tsdb/%s/%s",
+ snprintf(callback_name, sizeof(callback_name), "write_tsdb/%s/%s",
cb->node != NULL ? cb->node : WT_DEFAULT_NODE,
cb->service != NULL ? cb->service : WT_DEFAULT_SERVICE);
diff --git a/src/xencpu.c b/src/xencpu.c
index bf1786477eeebf2342025034fd92560878953002..8cba476f723197bb645dab029f756d57ebdcd27a 100644 (file)
--- a/src/xencpu.c
+++ b/src/xencpu.c
sstrncpy(vl.type_instance, "load", sizeof(vl.type_instance));
if (cpu_num >= 0) {
- ssnprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i", cpu_num);
+ snprintf(vl.plugin_instance, sizeof(vl.plugin_instance), "%i", cpu_num);
}
plugin_dispatch_values(&vl);
} /* static void submit_value */
diff --git a/src/zfs_arc.c b/src/zfs_arc.c
index cf858f8f55867c44f2b82b083187d982748600fb..86af7d498b22e2603d7380e91e3b5fcd878fdb11 100644 (file)
--- a/src/zfs_arc.c
+++ b/src/zfs_arc.c
size_t valuelen = sizeof(value);
int rv;
- ssnprintf(buffer, sizeof(buffer), "%s%s", zfs_arcstat, name);
+ snprintf(buffer, sizeof(buffer), "%s%s", zfs_arcstat, name);
rv = sysctlbyname(buffer, (void *)&value, &valuelen,
/* new value = */ NULL, /* new length = */ (size_t)0);
if (rv == 0)