Skip to content

Commit 25e63d7

Browse files
committed
dmidecode: Add helper function for structure errors
Add a helper function to print structure errors, specifically for structures which do not fit in the table. Signed-off-by: Jean Delvare <[email protected]>
1 parent 9c7db76 commit 25e63d7

File tree

3 files changed

+14
-1
lines changed

3 files changed

+14
-1
lines changed

dmidecode.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5195,7 +5195,7 @@ static void dmi_table_decode(u8 *buf, u32 len, u16 num, u16 ver, u32 flags)
51955195
if ((unsigned long)(next - buf) > len)
51965196
{
51975197
if (display && !(opt.flags & FLAG_QUIET))
5198-
printf("\t<TRUNCATED>\n");
5198+
pr_struct_err("<TRUNCATED>");
51995199
pr_sep();
52005200
data = next;
52015201
break;

dmioutput.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,3 +123,15 @@ void pr_sep(void)
123123
{
124124
printf("\n");
125125
}
126+
127+
void pr_struct_err(const char *format, ...)
128+
{
129+
va_list args;
130+
131+
printf("\t");
132+
133+
va_start(args, format);
134+
vprintf(format, args);
135+
va_end(args);
136+
printf("\n");
137+
}

dmioutput.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,3 +31,4 @@ void pr_list_start(const char *name, const char *format, ...);
3131
void pr_list_item(const char *format, ...);
3232
void pr_list_end(void);
3333
void pr_sep(void);
34+
void pr_struct_err(const char *format, ...);

0 commit comments

Comments
 (0)