From: Kamil Wiatrowski Date: Mon, 12 Feb 2018 11:12:44 +0000 (+0000) Subject: intel_pmu: fix epel6 compilation issue X-Git-Url: https://git.octo.it/?a=commitdiff_plain;h=0a600b591a897e0b7cc2097098ed3b014fb9eec8;p=collectd.git intel_pmu: fix epel6 compilation issue To avoid compilation error on some versions of gcc the saveptr for strtok_r needs to be initilised to NULL. Change-Id: I7b30e51ecae33a6994ba7ea181cac0f33eef023f Signed-off-by: Kamil Wiatrowski --- diff --git a/src/intel_pmu.c b/src/intel_pmu.c index 6f8c79df..3e97000f 100644 --- a/src/intel_pmu.c +++ b/src/intel_pmu.c @@ -471,7 +471,7 @@ static int pmu_add_hw_events(struct eventlist *el, char **e, size_t count) { if (!events) return -1; - char *s, *tmp; + char *s, *tmp = NULL; for (s = strtok_r(events, ",", &tmp); s; s = strtok_r(NULL, ",", &tmp)) { /* Allocate memory for event struct that contains array of efd structs diff --git a/src/utils_config_cores.c b/src/utils_config_cores.c index f280f05a..9d869b98 100644 --- a/src/utils_config_cores.c +++ b/src/utils_config_cores.c @@ -80,7 +80,7 @@ static int str_to_uint(const char *s, unsigned *n) { * Number of elements placed into nums. */ static size_t str_list_to_nums(char *s, unsigned *nums, size_t nums_len) { - char *saveptr; + char *saveptr = NULL; char *token; size_t idx = 0;