Improve error log messages when saving settings fails

Log separate messages for `io_sync` error, `io_close` error and general write errors.
This commit is contained in:
Robert Müller 2024-01-07 12:23:37 +01:00
parent 43b1e5cb1f
commit a80d875e85

View file

@ -496,19 +496,27 @@ bool CConfigManager::Save()
WriteLine(pCommand);
}
if(m_Failed)
{
log_error("config", "ERROR: writing to %s failed", aConfigFileTmp);
}
if(io_sync(m_ConfigFile) != 0)
{
m_Failed = true;
log_error("config", "ERROR: synchronizing %s failed", aConfigFileTmp);
}
if(io_close(m_ConfigFile) != 0)
{
m_Failed = true;
log_error("config", "ERROR: closing %s failed", aConfigFileTmp);
}
m_ConfigFile = 0;
if(m_Failed)
{
log_error("config", "ERROR: writing to %s failed", aConfigFileTmp);
return false;
}