diff options
author | Yoo, Jae Hyun <jae.hyun.yoo@intel.com> | 2019-01-17 20:26:34 +0300 |
---|---|---|
committer | Yoo, Jae Hyun <jae.hyun.yoo@intel.com> | 2019-01-17 20:26:34 +0300 |
commit | 20ab6f8c50fbbfc07bec94b3a6ab21705de2e1ab (patch) | |
tree | 617e8aec832f9748bfed0c120e3752f8fb675d55 /gpiodaemon | |
parent | 3c477c551311e0d90e43020d0c4ea0fe27b7f08e (diff) | |
download | provingground-20ab6f8c50fbbfc07bec94b3a6ab21705de2e1ab.tar.xz |
Fix dangling file descriptor issue
This commit fixes dangling file descriptor issue on gpioutils.
Change-Id: Ieabb26ad2b8c6b81570d8142f0ba6816d3ad14e2
Signed-off-by: Yoo, Jae Hyun <jae.hyun.yoo@intel.com>
Diffstat (limited to 'gpiodaemon')
-rw-r--r-- | gpiodaemon/src/gpioutils.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/gpiodaemon/src/gpioutils.cpp b/gpiodaemon/src/gpioutils.cpp index 9561795..d2d4adc 100644 --- a/gpiodaemon/src/gpioutils.cpp +++ b/gpiodaemon/src/gpioutils.cpp @@ -42,6 +42,7 @@ void Gpio::gpioExport() { gpioExport << gpioNumber; } + gpioExport.close(); } } @@ -55,6 +56,7 @@ void Gpio::gpioUnexport() { gpioExport << gpioNumber; } + gpioExport.close(); } } @@ -69,6 +71,7 @@ GpioValue Gpio::getValue() { gpioFile >> gpioValue; } + gpioFile.close(); return gpioValue == "0" ? GpioValue::low : GpioValue::high; } @@ -85,6 +88,7 @@ void Gpio::setValue(const GpioValue& value) { gpioFile << std::to_string((uint8_t)value); } + gpioFile.close(); } std::string Gpio::getDirection() @@ -98,6 +102,7 @@ std::string Gpio::getDirection() { gpioFile >> direction; } + gpioFile.close(); return direction; } |