summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArseniy-Movshev <dodoradio@outlook.com>2023-05-31 18:02:33 +0100
committerArseniy-Movshev <dodoradio@outlook.com>2023-06-01 13:32:13 +0100
commit7a8565498f9894a6d8fbb8cd4462048a4c603418 (patch)
tree29519804745f75921ced28c0642825aad93b83d4
parente7e96569da0a2c06f48367ba27fe30f5b43adaba (diff)
Make sure we open files as readonly when we're reading them so we don't create random new files
This shouldn't happen anyway, but this change helps avoid error conditions
-rw-r--r--daemon/logger.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/daemon/logger.cpp b/daemon/logger.cpp
index 9e0450e..65b5c2b 100644
--- a/daemon/logger.cpp
+++ b/daemon/logger.cpp
@@ -108,7 +108,7 @@ bool dayFileExists(QString sensorPrefix, QDateTime dateTime) {
QStringList fileGetPrevRecord(QString sensorPrefix, QDateTime recordTime) {
qDebug() << fileNameForDate(recordTime.date(), sensorPrefix);
QFile file(fileNameForDate(recordTime.date(), sensorPrefix));
- if (!file.open(QIODevice::ReadWrite | QIODevice::Text)) {
+ if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) {
qDebug() << "failed to open file";
return {0,0};
}