sdm: Close current file stream.
- Close currently opened file stream before reusing fstream object
to open a new file. fstream open() fails if stream is already
associated with a file, object continues to point to current stream,
and a call to is_open() returns success.
Change-Id: I54850cc6a4879b5d4ea7b17fb3f847fded7c8dcd
CRs-Fixed: 1029997
diff --git a/sdm/libs/core/fb/hw_info.cpp b/sdm/libs/core/fb/hw_info.cpp
index 77d3b6a..dc01e39 100644
--- a/sdm/libs/core/fb/hw_info.cpp
+++ b/sdm/libs/core/fb/hw_info.cpp
@@ -522,8 +522,10 @@
DLOGI("First display is internal display");
}
+ fs.close();
fs.open("/sys/devices/virtual/graphics/fb0/connected", fstream::in);
if (!fs.is_open()) {
+ // If fb0 is for a DSI/connected panel, then connected node will not exist.
hw_disp_info->is_connected = true;
} else {
if (!Sys::getline_(fs, line)) {