From: Daniel P. Berrange Date: Wed, 3 Apr 2013 19:28:35 +0000 (+0100) Subject: Cope with missing /sys/devices/system/cpu/cpu0/topology files X-Git-Tag: v1.0.5-rc1~251 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=4a2891510bb94360ca3d7e74adc26677310d9627;p=thirdparty%2Flibvirt.git Cope with missing /sys/devices/system/cpu/cpu0/topology files Not all kernel builds have any entries under the location /sys/devices/system/cpu/cpu0/topology. We already cope with that being missing in some cases, but not all. Update the code which looks for thread_siblings to cope with the missing file Signed-off-by: Daniel P. Berrange --- diff --git a/src/nodeinfo.c b/src/nodeinfo.c index 415c2e5f6c..72ab394423 100644 --- a/src/nodeinfo.c +++ b/src/nodeinfo.c @@ -168,6 +168,12 @@ virNodeCountThreadSiblings(const char *dir, unsigned int cpu) pathfp = fopen(path, "r"); if (pathfp == NULL) { + /* If file doesn't exist, then pretend our only + * sibling is ourself */ + if (errno == ENOENT) { + VIR_FREE(path); + return 1; + } virReportSystemError(errno, _("cannot open %s"), path); VIR_FREE(path); return 0;