Blob Blame History Raw
From dcbff064744f8b7c0d53d6932d25708b4bb13b4f Mon Sep 17 00:00:00 2001
From: Jean Delvare <jdelvare@suse.de>
Date: Fri, 22 Jul 2016 10:26:41 +0200
Subject: [PATCH 13/17] dmidecode: Clarify error message on table read failure

Stop using the term "unreachable" when the DMI table can't be read. It
originates from the /dev/mem access method, but no longer makes sense
when reading from sysfs or from a binary dump file.

Also don't suggest building with -DUSE_MMAP if reading from sysfs, as
it wouldn't help anyway.
---
 dmidecode.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/dmidecode.c b/dmidecode.c
index 48d9e66..ffd916c 100644
--- a/dmidecode.c
+++ b/dmidecode.c
@@ -4550,11 +4550,12 @@ static void dmi_table(off_t base, u32 len, u16 num, u16 ver, const char *devmem,
 
 	if (buf == NULL)
 	{
-		fprintf(stderr, "Table is unreachable, sorry."
+		fprintf(stderr, "Failed to read table, sorry.\n");
 #ifndef USE_MMAP
-			" Try compiling dmidecode with -DUSE_MMAP."
+		if (!(flags & FLAG_NO_FILE_OFFSET))
+			fprintf(stderr,
+				"Try compiling dmidecode with -DUSE_MMAP.\n");
 #endif
-			"\n");
 		return;
 	}
 
-- 
2.7.4