File sblim-gather-zECKD-attributes-array.patch of Package sblim-gather.12177

From: Petr Tesarik <ptesarik@suse.com>
Date: 2017-03-24 14:25:43 +0100
Subject: Use an array type for attribute buffer
References: bsc#1028716
Upstream: not yet

The author probably wanted to make an array of fixed-length strings,
but declared an array of pointers to strings... which gets initialized
to NULL by calloc().

*sigh*

Signed-off-by: Petr Tesarik <ptesarik@suse.com>
---
 plugin/metriczECKD.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/plugin/metriczECKD.c
+++ b/plugin/metriczECKD.c
@@ -160,7 +160,7 @@ char* readSysFs(char* deviceName) {
 	     ATTRIBUTES[attributeCount] != NULL;
 	     ++attributeCount);
 
-	char** attributeValues = calloc(attributeCount, 256);
+	char (*attributeValues)[256] = calloc(attributeCount, 256);
 	if (attributeValues == NULL) {
 		fprintf(stderr, "calloc() failed\n");
 		return NULL;
openSUSE Build Service is sponsored by