mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-20 13:23:34 -07:00
Make modifying log file perms best effort
qBittorrent is able to write to the log file, so it's ok if the permission change fails. The downside will be that the file remains readable to the world.
This commit is contained in:
parent
054003970e
commit
ebc974a1ba
1 changed files with 5 additions and 3 deletions
|
@ -175,12 +175,14 @@ void FileLogger::flushLog()
|
|||
|
||||
void FileLogger::openLogFile()
|
||||
{
|
||||
if (!m_logFile.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text)
|
||||
|| !m_logFile.setPermissions(QFile::ReadOwner | QFile::WriteOwner))
|
||||
if (!m_logFile.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text))
|
||||
{
|
||||
m_logFile.close();
|
||||
LogMsg(tr("An error occurred while trying to open the log file. Logging to file is disabled."), Log::CRITICAL);
|
||||
return;
|
||||
}
|
||||
|
||||
// best effort, don't report error
|
||||
m_logFile.setPermissions(QFile::ReadOwner | QFile::WriteOwner);
|
||||
}
|
||||
|
||||
void FileLogger::closeLogFile()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue