From cc8aeb6b34fdfb6791f4cd15c1adf59a40ee313a Mon Sep 17 00:00:00 2001 From: yaomanhai Date: Sat, 31 Jul 2021 07:20:00 +0000 Subject: [PATCH] persist file wrong open mode --- services/hilogd/log_persister_rotator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/services/hilogd/log_persister_rotator.cpp b/services/hilogd/log_persister_rotator.cpp index c8277e9..36003ac 100644 --- a/services/hilogd/log_persister_rotator.cpp +++ b/services/hilogd/log_persister_rotator.cpp @@ -86,7 +86,7 @@ void LogPersisterRotator::InternalRotate() cout << "OLD NAME " << oldName << " NEW NAME " << newName << endl; rename(oldName.c_str(), newName.c_str()); } - output.open(ss.str(), ios::trunc); + output.open(ss.str(), ios::out | ios::trunc); } void LogPersisterRotator::Rotate() @@ -99,7 +99,7 @@ void LogPersisterRotator::Rotate() stringstream ss; ss << fileName << "." << index << fileSuffix; cout << "THE FILE NAME !!!!!!! " << ss.str() << endl; - output.open(ss.str(), ios::trunc); + output.open(ss.str(), ios::out | ios::trunc); } fseek(fdinfo, 0, SEEK_SET); fwrite(&index, sizeof(uint8_t), 1, fdinfo); -- Gitee