Re #1567: writeBackup(): added PID to temporary file name

This commit is contained in:
Damjan Adamic
2014-08-03 17:38:24 +02:00
parent 55cb5dce87
commit c0e612531d
+3 -5
View File
@@ -1172,12 +1172,12 @@ void MainWindow::writeBackup()
} }
int oldrev = getEpromVersion(fileName); int oldrev = getEpromVersion(fileName);
QString tempDir = QDir::tempPath(); QString tempDir = QDir::tempPath();
QString tempFlash = tempDir + "/flash.bin"; QString tempFlash = tempDir + QString("/flash-%1.bin").arg(QCoreApplication::applicationPid());
if (!readFirmwareFromRadio(tempFlash)) if (!readFirmwareFromRadio(tempFlash))
return; return;
QString restoreFile = tempDir + "/compat.bin"; QString restoreFile = tempDir + QString("/compat.bin-%1.bin").arg(QCoreApplication::applicationPid());
if (!convertEEPROM(fileName, restoreFile, tempFlash)) { if (!convertEEPROM(fileName, restoreFile, tempFlash)) {
int ret = QMessageBox::question(this, "Error", tr("Cannot check Models and Settings compatibility! Continue anyway?") , int ret = QMessageBox::question(this, "Error", tr("Cannot check Models and Settings compatibility! Continue anyway?") ,
QMessageBox::Yes | QMessageBox::No); QMessageBox::Yes | QMessageBox::No);
@@ -1194,9 +1194,7 @@ void MainWindow::writeBackup()
} }
fileName = restoreFile; fileName = restoreFile;
} }
QByteArray ba = tempFlash.toLatin1(); unlink(tempFlash.toAscii());
char *name = ba.data();
unlink(name);
} }
else { else {
if (backupEnable) { if (backupEnable) {