mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-04-08 14:47:31 +02:00
log: Use LogError for fatal errors
This commit is contained in:
@@ -102,28 +102,28 @@ std::streampos GetFileSize(const char* path, std::streamsize max)
|
||||
bool FileCommit(FILE* file)
|
||||
{
|
||||
if (fflush(file) != 0) { // harmless if redundantly called
|
||||
LogPrintf("fflush failed: %s\n", SysErrorString(errno));
|
||||
LogError("fflush failed: %s", SysErrorString(errno));
|
||||
return false;
|
||||
}
|
||||
#ifdef WIN32
|
||||
HANDLE hFile = (HANDLE)_get_osfhandle(_fileno(file));
|
||||
if (FlushFileBuffers(hFile) == 0) {
|
||||
LogPrintf("FlushFileBuffers failed: %s\n", Win32ErrorString(GetLastError()));
|
||||
LogError("FlushFileBuffers failed: %s", Win32ErrorString(GetLastError()));
|
||||
return false;
|
||||
}
|
||||
#elif defined(__APPLE__) && defined(F_FULLFSYNC)
|
||||
if (fcntl(fileno(file), F_FULLFSYNC, 0) == -1) { // Manpage says "value other than -1" is returned on success
|
||||
LogPrintf("fcntl F_FULLFSYNC failed: %s\n", SysErrorString(errno));
|
||||
LogError("fcntl F_FULLFSYNC failed: %s", SysErrorString(errno));
|
||||
return false;
|
||||
}
|
||||
#elif HAVE_FDATASYNC
|
||||
if (fdatasync(fileno(file)) != 0 && errno != EINVAL) { // Ignore EINVAL for filesystems that don't support sync
|
||||
LogPrintf("fdatasync failed: %s\n", SysErrorString(errno));
|
||||
LogError("fdatasync failed: %s", SysErrorString(errno));
|
||||
return false;
|
||||
}
|
||||
#else
|
||||
if (fsync(fileno(file)) != 0 && errno != EINVAL) {
|
||||
LogPrintf("fsync failed: %s\n", SysErrorString(errno));
|
||||
LogError("fsync failed: %s", SysErrorString(errno));
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
@@ -235,7 +235,7 @@ fs::path GetSpecialFolderPath(int nFolder, bool fCreate)
|
||||
return fs::path(pszPath);
|
||||
}
|
||||
|
||||
LogPrintf("SHGetSpecialFolderPathW() failed, could not obtain requested path.\n");
|
||||
LogError("SHGetSpecialFolderPathW() failed, could not obtain requested path.");
|
||||
return fs::path("");
|
||||
}
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user