From 44f5b3f86926d907b31fae22c873421b8d4680fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A1n=20Tomko?= Date: Tue, 21 Jun 2016 13:20:48 +0200 Subject: [PATCH] Do not check the return value of closedir 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 4ed7b217d8..0cdba0a0cd 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);