summaryrefslogtreecommitdiffstats
path: root/src/sdk/updatechecker.cpp
diff options
context:
space:
mode:
authorkh1 <karsten.heimrich@digia.com>2014-11-07 12:27:00 +0100
committerKarsten Heimrich <karsten.heimrich@theqtcompany.com>2014-11-12 21:22:51 +0100
commitb67c842ba8bba3ba908fffe9546ad364693acb2c (patch)
treeeccd8131944c23bbc91a29ccb05ef13e7028fe65 /src/sdk/updatechecker.cpp
parentb1b9a3df473b3a27629be91cab0058b0e140d06d (diff)
Make sure we do not fail if we can't create the lock file.
If we can't lock the file (possible missing privileges to create and lock it), we now check the running processes before we fail. Task-number: QTIFW-566 Change-Id: I821ccf8c37d6a235df49e060c59a0283bb91261c Reviewed-by: Takayuki ORITO Reviewed-by: Kai Koehne <kai.koehne@theqtcompany.com> Reviewed-by: Niels Weber <niels.weber@digia.com>
Diffstat (limited to 'src/sdk/updatechecker.cpp')
-rw-r--r--src/sdk/updatechecker.cpp12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/sdk/updatechecker.cpp b/src/sdk/updatechecker.cpp
index eec35bacd..7f2e50275 100644
--- a/src/sdk/updatechecker.cpp
+++ b/src/sdk/updatechecker.cpp
@@ -54,9 +54,15 @@ UpdateChecker::UpdateChecker(int &argc, char *argv[])
int UpdateChecker::check()
{
- KDRunOnceChecker runCheck((QLatin1String("lockmyApp15021976.lock")));
- if (runCheck.isRunning(KDRunOnceChecker::ConditionFlag::Lockfile))
- throw QInstaller::Error(QLatin1String("An instance is already checking for updates."));
+ KDRunOnceChecker runCheck(qApp->applicationDirPath() + QLatin1String("/lockmyApp15021976.lock"));
+ if (runCheck.isRunning(KDRunOnceChecker::ConditionFlag::Lockfile)) {
+ // It is possible to install an application and thus the maintenance tool into a
+ // directory that requires elevated permission to create a lock file. Since this
+ // cannot be done without requesting credentials from the user, we silently ignore
+ // the fact that we could not create the lock file and check the running processes.
+ if (runCheck.isRunning(KDRunOnceChecker::ConditionFlag::ProcessList))
+ throw QInstaller::Error(QLatin1String("An instance is already checking for updates."));
+ }
QString fileName = datFile(binaryFile());
quint64 cookie = QInstaller::BinaryContent::MagicCookieDat;