From: Prerna Saxena Date: Tue, 7 Feb 2012 11:35:37 +0000 (+0530) Subject: On systems with dmidecode version 2.10 or older, X-Git-Url: http://xenbits.xensource.com/gitweb?a=commitdiff_plain;h=a76530c9c7ac6b0fb67ef15c28fec1976d3ca64b;p=libvirt.git On systems with dmidecode version 2.10 or older, dmidecode displays processor information, followed by BIOS, system and memory-DIMM details. Calls to virSysinfoParseBIOS(), virSysinfoParseSystem() would update the buffer pointer 'base', so the processor information would be lost before virSysinfoParseProcessor() was called. Sysinfo would therefore not be able to display processor details -- It only described , and details. This patch attempts to insulate sysinfo from ordering of dmidecode output. Before the fix: --------------- virsh # sysinfo .... .... .... After the fix: ------------- virsh # sysinfo .... .... .... .... --- diff --git a/src/util/sysinfo.c b/src/util/sysinfo.c index de3108a7fc..0e55d7ea4e 100644 --- a/src/util/sysinfo.c +++ b/src/util/sysinfo.c @@ -453,7 +453,7 @@ no_memory: virSysinfoDefPtr virSysinfoRead(void) { - char *path, *base; + char *path; virSysinfoDefPtr ret = NULL; char *outbuf = NULL; virCommandPtr cmd; @@ -481,22 +481,20 @@ virSysinfoRead(void) { ret->type = VIR_SYSINFO_SMBIOS; - base = outbuf; - - if ((base = virSysinfoParseBIOS(base, ret)) == NULL) + if ((virSysinfoParseBIOS(outbuf, ret)) == NULL) goto no_memory; - if ((base = virSysinfoParseSystem(base, ret)) == NULL) + if ((virSysinfoParseSystem(outbuf, ret)) == NULL) goto no_memory; ret->nprocessor = 0; ret->processor = NULL; - if ((base = virSysinfoParseProcessor(base, ret)) == NULL) + if ((virSysinfoParseProcessor(outbuf, ret)) == NULL) goto no_memory; ret->nmemory = 0; ret->memory = NULL; - if (virSysinfoParseMemory(base, ret) == NULL) + if (virSysinfoParseMemory(outbuf, ret) == NULL) goto no_memory; cleanup: