mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2025-06-27 17:09:53 -04: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. PR #22800.
This commit is contained in:
parent
0c48b70e5b
commit
c59ac3b970
1 changed files with 7 additions and 4 deletions
|
@ -175,12 +175,15 @@ 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);
|
||||
LogMsg(tr("An error occurred while trying to open the log file. Logging to file is disabled. File: \"%1\". Error: \"%2\".")
|
||||
.arg(m_logFile.fileName(), m_logFile.errorString()), 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