[PATCH 03/18] Do not check the return value of closedir

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

 



The only possible error is EBADFD.
Since we only use the directory stream returned by opendir,
this should never happen.
---
 src/util/virhostcpu.c | 15 ++++-----------
 1 file changed, 4 insertions(+), 11 deletions(-)

diff --git a/src/util/virhostcpu.c b/src/util/virhostcpu.c
index 4ed7b21..0cdba0a 100644
--- a/src/util/virhostcpu.c
+++ b/src/util/virhostcpu.c
@@ -477,11 +477,8 @@ virHostCPUParseNode(const char *node,
     ret = processors;
 
  cleanup:
-    /* don't shadow a more serious error */
-    if (cpudir && closedir(cpudir) < 0 && ret >= 0) {
-        virReportSystemError(errno, _("problem closing %s"), node);
-        ret = -1;
-    }
+    if (cpudir)
+        closedir(cpudir);
     if (cores_maps)
         for (i = 0; i < sock_max; i++)
             virBitmapFree(cores_maps[i]);
@@ -777,12 +774,8 @@ virHostCPUGetInfoPopulateLinux(FILE *cpuinfo,
     ret = 0;
 
  cleanup:
-    /* don't shadow a more serious error */
-    if (nodedir && closedir(nodedir) < 0 && ret >= 0) {
-        virReportSystemError(errno, _("problem closing %s"), sysfs_nodedir);
-        ret = -1;
-    }
-
+    if (nodedir)
+        closedir(nodedir);
     virBitmapFree(present_cpus_map);
     virBitmapFree(online_cpus_map);
     VIR_FREE(sysfs_nodedir);
-- 
2.7.3

--
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]