closedir patch
Michael Vetter
In case dir is NULL we should not call closedir() since it's behaviour is implementation specific.
Patch attached. Please apply with `git am <
powertop-only-closedir.patch`.
From 553294813635c074230a9d8ba0d7736c23f15ddd Mon Sep 17 00:00:00 2001
From: Michael Vetter <[email protected]>
Date: Tue, 3 Sep 2019 12:56:04 +0200
Subject: [PATCH] intel_cpus.cpp: Only call closedir() if opened
In case dir is NULL we should not call closedir() since it's behaviour is implementation specific.
--- src/cpu/intel_cpus.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
src/cpu/intel_cpus.cpp +5 -4
@@ -142,11 +142,12 @@ intel_util::intel_util() void intel_util::byt_has_ahci() { dir = opendir("/sys/bus/pci/devices/0000:00:13.0"); - if (!dir) - byt_ahci_support=0; - else + if (!dir) + byt_ahci_support=0; + else { byt_ahci_support=1; - closedir(dir); + closedir(dir); + } } int intel_util::get_byt_ahci_support()