Check action type before launching new version

This commit is contained in:
Ilya Fedin 2021-05-03 15:48:31 +04:00 committed by John Preston
parent 68dc00be27
commit 9a857659ce

View File

@ -83,7 +83,7 @@ bool Launcher::launchUpdater(UpdaterLaunch action) {
: (cExeDir() + qsl("Updater"))); : (cExeDir() + qsl("Updater")));
auto argumentsList = Arguments(); auto argumentsList = Arguments();
if (action != UpdaterLaunch::JustRelaunch && cWriteProtected()) { if (action == UpdaterLaunch::PerformUpdate && cWriteProtected()) {
argumentsList.push("pkexec"); argumentsList.push("pkexec");
} }
argumentsList.push(QFile::encodeName(binaryPath)); argumentsList.push(QFile::encodeName(binaryPath));
@ -141,7 +141,7 @@ bool Launcher::launchUpdater(UpdaterLaunch action) {
} }
// pkexec needs an alive parent // pkexec needs an alive parent
if (cWriteProtected()) { if (action == UpdaterLaunch::PerformUpdate && cWriteProtected()) {
waitpid(pid, nullptr, 0); waitpid(pid, nullptr, 0);
// launch new version in the same environment // launch new version in the same environment
return launchUpdater(UpdaterLaunch::JustRelaunch); return launchUpdater(UpdaterLaunch::JustRelaunch);