[PATCH 3/4] nodeinfotest: Print error if cpuinfo file can't be opened

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Currently, we are opening the cpuinfo file via fopen() which if fails
doesn't print any error message. We should do that instead.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 tests/nodeinfotest.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/tests/nodeinfotest.c b/tests/nodeinfotest.c
index f0b8196..650a674 100644
--- a/tests/nodeinfotest.c
+++ b/tests/nodeinfotest.c
@@ -39,8 +39,11 @@ linuxTestCompareFiles(const char *cpuinfofile,
         goto fail;
 
     cpuinfo = fopen(cpuinfofile, "r");
-    if (!cpuinfo)
+    if (!cpuinfo) {
+        fprintf(stderr, "unable to open: %s : %s\n",
+                cpuinfofile, strerror(errno));
         goto fail;
+    }
 
     memset(&nodeinfo, 0, sizeof(nodeinfo));
     if (linuxNodeInfoCPUPopulate(cpuinfo, sysfs_dir, arch, &nodeinfo) < 0) {
-- 
1.8.5.5

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list




[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]