From: Florian Forster Date: Sat, 6 Aug 2016 18:15:51 +0000 (+0200) Subject: src/utils_db_query.c: Check return status of strjoin(). X-Git-Tag: collectd-5.6.0~3^2~7^2 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=496ca2b758344bc6372ab0adf98ad8050f69b25a;p=collectd.git src/utils_db_query.c: Check return status of strjoin(). Fixes: #4 --- diff --git a/src/utils_db_query.c b/src/utils_db_query.c index 6b3c056c..9a168739 100644 --- a/src/utils_db_query.c +++ b/src/utils_db_query.c @@ -236,15 +236,27 @@ static int udb_result_submit (udb_result_t *r, /* {{{ */ { if (r->instance_prefix == NULL) { - strjoin (vl.type_instance, sizeof (vl.type_instance), + int status = strjoin (vl.type_instance, sizeof (vl.type_instance), r_area->instances_buffer, r->instances_num, "-"); + if (status != 0) + { + ERROR ("udb_result_submit: creating type_instance failed with status %d.", + status); + return (status); + } } else { char tmp[DATA_MAX_NAME_LEN]; - strjoin (tmp, sizeof (tmp), r_area->instances_buffer, + int status = strjoin (tmp, sizeof (tmp), r_area->instances_buffer, r->instances_num, "-"); + if (status != 0) + { + ERROR ("udb_result_submit: creating type_instance failed with status %d.", + status); + return (status); + } tmp[sizeof (tmp) - 1] = 0; snprintf (vl.type_instance, sizeof (vl.type_instance), "%s-%s",