Blame SOURCES/0019-dmidecode-Add-helper-function-for-structure-errors.patch

f877e3
From 25e63d7757f77a15704175c00193753be4176797 Mon Sep 17 00:00:00 2001
f877e3
From: Jean Delvare <jdelvare@suse.de>
f877e3
Date: Wed, 1 Apr 2020 10:00:36 +0200
f877e3
Subject: [PATCH 19/23] dmidecode: Add helper function for structure errors
f877e3
f877e3
Add a helper function to print structure errors, specifically for
f877e3
structures which do not fit in the table.
f877e3
f877e3
Signed-off-by: Jean Delvare <jdelvare@suse.de>
f877e3
---
f877e3
 dmidecode.c |  2 +-
f877e3
 dmioutput.c | 12 ++++++++++++
f877e3
 dmioutput.h |  1 +
f877e3
 3 files changed, 14 insertions(+), 1 deletion(-)
f877e3
f877e3
diff --git a/dmidecode.c b/dmidecode.c
f877e3
index 3551637e7b16..59f4fe09e642 100644
f877e3
--- a/dmidecode.c
f877e3
+++ b/dmidecode.c
f877e3
@@ -5195,7 +5195,7 @@ static void dmi_table_decode(u8 *buf, u32 len, u16 num, u16 ver, u32 flags)
f877e3
 		if ((unsigned long)(next - buf) > len)
f877e3
 		{
f877e3
 			if (display && !(opt.flags & FLAG_QUIET))
f877e3
-				printf("\t<TRUNCATED>\n");
f877e3
+				pr_struct_err("<TRUNCATED>");
f877e3
 			pr_sep();
f877e3
 			data = next;
f877e3
 			break;
f877e3
diff --git a/dmioutput.c b/dmioutput.c
f877e3
index ef1c41b2f94e..42f8d3218c43 100644
f877e3
--- a/dmioutput.c
f877e3
+++ b/dmioutput.c
f877e3
@@ -123,3 +123,15 @@ void pr_sep(void)
f877e3
 {
f877e3
 	printf("\n");
f877e3
 }
f877e3
+
f877e3
+void pr_struct_err(const char *format, ...)
f877e3
+{
f877e3
+	va_list args;
f877e3
+
f877e3
+	printf("\t");
f877e3
+
f877e3
+	va_start(args, format);
f877e3
+	vprintf(format, args);
f877e3
+	va_end(args);
f877e3
+	printf("\n");
f877e3
+}
f877e3
diff --git a/dmioutput.h b/dmioutput.h
f877e3
index 6b5f0e0e92c5..a492ec0eb4e7 100644
f877e3
--- a/dmioutput.h
f877e3
+++ b/dmioutput.h
f877e3
@@ -31,3 +31,4 @@ void pr_list_start(const char *name, const char *format, ...);
f877e3
 void pr_list_item(const char *format, ...);
f877e3
 void pr_list_end(void);
f877e3
 void pr_sep(void);
f877e3
+void pr_struct_err(const char *format, ...);
f877e3
-- 
f877e3
2.17.1
f877e3