[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[dmidecode] [PATCH 11/11] dmidecode: Add helper function for structure e
From: |
Jean Delvare |
Subject: |
[dmidecode] [PATCH 11/11] dmidecode: Add helper function for structure errors |
Date: |
Tue, 24 Mar 2020 17:42:03 +0100 |
Add a helper function to print structure errors, specifically for
structures which do not fit in the table.
Signed-off-by: Jean Delvare <address@hidden>
---
dmidecode.c | 2 +-
dmioutput.c | 12 ++++++++++++
dmioutput.h | 1 +
3 files changed, 14 insertions(+), 1 deletion(-)
--- dmidecode.orig/dmidecode.c 2020-03-24 15:01:50.906283939 +0100
+++ dmidecode/dmidecode.c 2020-03-24 15:02:07.140481636 +0100
@@ -5195,7 +5195,7 @@ static void dmi_table_decode(u8 *buf, u3
if ((unsigned long)(next - buf) > len)
{
if (display && !(opt.flags & FLAG_QUIET))
- printf("\t<TRUNCATED>\n");
+ pr_struct_err("<TRUNCATED>");
pr_sep();
data = next;
break;
--- dmidecode.orig/dmioutput.c 2020-03-24 15:01:50.906283939 +0100
+++ dmidecode/dmioutput.c 2020-03-24 15:02:07.140481636 +0100
@@ -123,3 +123,15 @@ void pr_sep(void)
{
printf("\n");
}
+
+void pr_struct_err(const char *format, ...)
+{
+ va_list args;
+
+ printf("\t");
+
+ va_start(args, format);
+ vprintf(format, args);
+ va_end(args);
+ printf("\n");
+}
--- dmidecode.orig/dmioutput.h 2020-03-24 15:01:50.906283939 +0100
+++ dmidecode/dmioutput.h 2020-03-24 15:02:07.140481636 +0100
@@ -31,3 +31,4 @@ void pr_list_start(const char *name, con
void pr_list_item(const char *format, ...);
void pr_list_end(void);
void pr_sep(void);
+void pr_struct_err(const char *format, ...);
--
Jean Delvare
SUSE L3 Support
- [dmidecode] [PATCH 01/11] dmidecode: Add helper function pr_comment, (continued)
- [dmidecode] [PATCH 01/11] dmidecode: Add helper function pr_comment, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 03/11] dmidecode: Protect dmidecode.h against double inclusion, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 02/11] dmidecode: Add helper function pr_info, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 04/11] dmidecode: Add helper function pr_handle, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 05/11] dmidecode: Add helper function pr_handle_name, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 06/11] dmidecode: Add helper function pr_attr, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 07/11] dmidecode: Add helper functions pr_list_start/item/end, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 08/11] dmidecode: Add helper function pr_subattr, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 09/11] dmidecode: Use the print helpers in dump mode too, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 10/11] dmidecode: Add helper function for separators, Jean Delvare, 2020/03/24
- [dmidecode] [PATCH 11/11] dmidecode: Add helper function for structure errors,
Jean Delvare <=