X-Git-Url: https://git.octo.it/?a=blobdiff_plain;f=src%2Fintel_pmu.c;h=fc7d6804d7a2cf2c0f961a476487e082747bb1ea;hb=da11ce02eb202b3e01d3e2d1b40f248a84430973;hp=3e97000f34c4ebfc099eab8b15dd72b4251e8e9d;hpb=0a600b591a897e0b7cc2097098ed3b014fb9eec8;p=collectd.git diff --git a/src/intel_pmu.c b/src/intel_pmu.c index 3e97000f..fc7d6804 100644 --- a/src/intel_pmu.c +++ b/src/intel_pmu.c @@ -1,7 +1,7 @@ /** * collectd - src/intel_pmu.c * - * Copyright(c) 2017 Intel Corporation. All rights reserved. + * Copyright(c) 2017-2018 Intel Corporation. All rights reserved. * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal @@ -213,8 +213,12 @@ static void pmu_dump_cgroups(void) { return; } for (size_t j = 0; j < cgroup->num_cores; j++) - snprintf(cores + strlen(cores), cores_size - strlen(cores), " %d", - cgroup->cores[j]); + if (snprintf(cores + strlen(cores), cores_size - strlen(cores), " %d", + cgroup->cores[j]) < 0) { + DEBUG(PMU_PLUGIN ": Failed to write list of cores to string."); + sfree(cores); + return; + } DEBUG(PMU_PLUGIN ": group[%" PRIsz "]", i); DEBUG(PMU_PLUGIN ": description: %s", cgroup->desc); @@ -325,8 +329,8 @@ static int pmu_config(oconfig_item_t *ci) { return 0; } -static void pmu_submit_counter(char *cgroup, char *event, counter_t value, - meta_data_t *meta) { +static void pmu_submit_counter(const char *cgroup, const char *event, + counter_t value, meta_data_t *meta) { value_list_t vl = VALUE_LIST_INIT; vl.values = &(value_t){.counter = value};