summaryrefslogtreecommitdiff
path: root/src/Device
diff options
context:
space:
mode:
authorHarsh Sharma <harsh.sharma@multitech.com>2019-12-20 12:12:05 -0600
committerHarsh Sharma <harsh.sharma@multitech.com>2019-12-20 12:12:05 -0600
commit41f2282b2a80f772bf363e8127669377873627cb (patch)
tree90a8710f0069161a29417cf3c3c1af9c5a6ced4c /src/Device
parent8ce2b9763c880084fd9d38fae6033e487fde58d9 (diff)
downloadmts-io-sysfs-41f2282b2a80f772bf363e8127669377873627cb.tar.gz
mts-io-sysfs-41f2282b2a80f772bf363e8127669377873627cb.tar.bz2
mts-io-sysfs-41f2282b2a80f772bf363e8127669377873627cb.zip
Bug fix for writing device_info.json
Diffstat (limited to 'src/Device')
-rw-r--r--src/Device/Device.cpp10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/Device/Device.cpp b/src/Device/Device.cpp
index 573e10b..bbfb189 100644
--- a/src/Device/Device.cpp
+++ b/src/Device/Device.cpp
@@ -410,13 +410,11 @@ void Device::writeJson() {
rapidjson::StringBuffer buffer;
rapidjson::Writer<rapidjson::StringBuffer> writer(buffer);
deviceInfo.Accept(writer);
- std::string json (buffer.GetString(), buffer.GetSize());
- std::ofstream of ("/var/run/config/device_info.json");
- of << json;
- if (!of.good()) {
- logError("Can't write to /var/run/config/device_info.json");
+ std::ofstream os(DEVICE_INFO_FILE);
+ if (!os) {
+ logError("Can't write to " + std::string(DEVICE_INFO_FILE));
exitHandler(99);
} else {
- exitHandler(0);
+ os << buffer.GetString();
}
}