diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2017-02-27 14:03:15 +0100 |
---|---|---|
committer | Olivier Goffart (Woboq GmbH) <ogoffart@woboq.com> | 2017-03-10 17:09:24 +0000 |
commit | b52b509ae48125ce9ba3cb50560e2e9ff81b485e (patch) | |
tree | 23af337d785f0abe19da0f30d844cfee29d02e77 /src/corelib/io/qlockfile_unix.cpp | |
parent | 137e6632c89a04c7785a005752e8a21b60678705 (diff) |
QLockFile: Don't deadlock if the lock file has a mtime in the future
Stale Lock files in the future can happen in some situations. For exemple
two computers with different clocks access the same file system. It could
be that one of the timestamp is totaly off (several years into the future).
[ChangeLog][QtCore][QLockFile] Fixed a deadlock occurring if a corrupted
lock file's modification time is in the future.
Change-Id: I8dac98a0e898c76bcef67f8c195e126c996b6add
Reviewed-by: David Faure <david.faure@kdab.com>
Diffstat (limited to 'src/corelib/io/qlockfile_unix.cpp')
-rw-r--r-- | src/corelib/io/qlockfile_unix.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/corelib/io/qlockfile_unix.cpp b/src/corelib/io/qlockfile_unix.cpp index 3a80014c00..5a02741727 100644 --- a/src/corelib/io/qlockfile_unix.cpp +++ b/src/corelib/io/qlockfile_unix.cpp @@ -247,7 +247,7 @@ bool QLockFilePrivate::isApparentlyStale() const } } const qint64 age = QFileInfo(fileName).lastModified().msecsTo(QDateTime::currentDateTime()); - return staleLockTime > 0 && age > staleLockTime; + return staleLockTime > 0 && qAbs(age) > staleLockTime; } QString QLockFilePrivate::processNameByPid(qint64 pid) |