mirror of
https://github.com/feather-wallet/feather.git
synced 2024-12-22 11:39:25 +00:00
Tor: properly overwrite old binary
This commit is contained in:
parent
cfd1942b38
commit
69551efde3
2 changed files with 10 additions and 2 deletions
|
@ -211,8 +211,12 @@ bool Tor::unpackBins() {
|
|||
TorVersion embeddedVersion = this->stringToVersion(QString(TOR_VERSION));
|
||||
TorVersion filesystemVersion = this->getVersion(torPath);
|
||||
qDebug() << QString("Tor versions: embedded %1, filesystem %2").arg(embeddedVersion.toString(), filesystemVersion.toString());
|
||||
if (embeddedVersion > filesystemVersion) {
|
||||
QFile::remove(torPath);
|
||||
if (TorVersion::isValid(filesystemVersion) && (embeddedVersion > filesystemVersion)) {
|
||||
qInfo() << "Embedded version is newer, overwriting.";
|
||||
QFile::setPermissions(torPath, QFile::ReadOther | QFile::WriteOther);
|
||||
if (!QFile::remove(torPath)) {
|
||||
qWarning() << "Unable to remove old Tor binary";
|
||||
};
|
||||
}
|
||||
|
||||
qDebug() << "Writing Tor executable to " << this->torPath;
|
||||
|
|
|
@ -54,6 +54,10 @@ struct TorVersion
|
|||
QString::number(patch), QString::number(release));
|
||||
}
|
||||
|
||||
static bool isValid(const TorVersion &v) {
|
||||
return v != TorVersion();
|
||||
}
|
||||
|
||||
int major;
|
||||
int minor;
|
||||
int patch;
|
||||
|
|
Loading…
Reference in a new issue