From: Florian Forster Date: Sat, 6 Aug 2016 19:21:56 +0000 (+0200) Subject: src/utils_db_query.c: Correctly handle return value of strjoin(). X-Git-Tag: collectd-5.6.0~3^2~5^2~1 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=e5ec04602ccc08aa45d8a9e60d9bcb476d3f9655;p=collectd.git src/utils_db_query.c: Correctly handle return value of strjoin(). It returns the number of bytes, not zero, on success. This fixes a bug introduced in 496ca2b758344bc6372ab0adf98ad8050f69b25a. --- diff --git a/src/utils_db_query.c b/src/utils_db_query.c index 9a168739..5fbdfd13 100644 --- a/src/utils_db_query.c +++ b/src/utils_db_query.c @@ -238,7 +238,7 @@ static int udb_result_submit (udb_result_t *r, /* {{{ */ { int status = strjoin (vl.type_instance, sizeof (vl.type_instance), r_area->instances_buffer, r->instances_num, "-"); - if (status != 0) + if (status < 0) { ERROR ("udb_result_submit: creating type_instance failed with status %d.", status); @@ -251,7 +251,7 @@ static int udb_result_submit (udb_result_t *r, /* {{{ */ int status = strjoin (tmp, sizeof (tmp), r_area->instances_buffer, r->instances_num, "-"); - if (status != 0) + if (status < 0) { ERROR ("udb_result_submit: creating type_instance failed with status %d.", status);