mirror of
https://github.com/keepassxreboot/keepassxc.git
synced 2024-10-01 01:26:01 -04:00
Do polling based file watching for NFS on linux, resolves #1799
This commit is contained in:
parent
44c9469221
commit
61d7e6bc6c
@ -58,6 +58,10 @@
|
||||
|
||||
#include "config-keepassx.h"
|
||||
|
||||
#ifdef Q_OS_LINUX
|
||||
#include <sys/vfs.h>
|
||||
#endif
|
||||
|
||||
#ifdef WITH_XC_SSHAGENT
|
||||
#include "sshagent/SSHAgent.h"
|
||||
#endif
|
||||
@ -1173,6 +1177,21 @@ void DatabaseWidget::updateFilePath(const QString& filePath)
|
||||
m_fileWatcher.removePath(m_filePath);
|
||||
}
|
||||
|
||||
#if defined(Q_OS_LINUX)
|
||||
struct statfs statfsBuf;
|
||||
bool forcePolling = false;
|
||||
const auto NFS_SUPER_MAGIC = 0x6969;
|
||||
|
||||
if (!statfs(filePath.toLocal8Bit().constData(), &statfsBuf)) {
|
||||
forcePolling = (statfsBuf.f_type == NFS_SUPER_MAGIC);
|
||||
} else {
|
||||
// if we can't get the fs type let's fall back to polling
|
||||
forcePolling = true;
|
||||
}
|
||||
auto objectName = forcePolling ? QLatin1String("_qt_autotest_force_engine_poller") : QLatin1String("");
|
||||
m_fileWatcher.setObjectName(objectName);
|
||||
#endif
|
||||
|
||||
m_fileWatcher.addPath(filePath);
|
||||
m_filePath = filePath;
|
||||
m_db->setFilePath(filePath);
|
||||
|
Loading…
Reference in New Issue
Block a user