From 7bac504eb60c9783f29632c4f405eb61ca9236c5 Mon Sep 17 00:00:00 2001
From: Katja Marttila <katja.marttila@qt.io>
Date: Wed, 13 Nov 2019 14:23:41 +0200
Subject: [PATCH] Fix installer executable creation in Linux

If Linux has several partitions and tmp is pointing to a different
partition than where we are trying to create installer executable with
binarycreator, binarycreator fails with 'Invalid cross-device link'.
Fixed so that tmp is not used when creating an installer executable.

Change-Id: Ieee52ee1929f980345a7940dd381cc94dbf3d40e
Reviewed-by: Iikka Eklund <iikka.eklund@qt.io>
Reviewed-by: Katja Marttila <katja.marttila@qt.io>
---
 tools/binarycreator/binarycreator.cpp | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/tools/binarycreator/binarycreator.cpp b/tools/binarycreator/binarycreator.cpp
index f9a8f31d..a18690a7 100644
--- a/tools/binarycreator/binarycreator.cpp
+++ b/tools/binarycreator/binarycreator.cpp
@@ -409,7 +409,8 @@ static int assemble(Input input, const QInstaller::Settings &settings, const QSt
     }
 #endif
 
-    QTemporaryFile out;
+    QFile out(generateTemporaryFileName());
+
     QString targetName = input.outputPath;
 #ifdef Q_OS_MACOS
     QDir resourcePath(QFileInfo(input.outputPath).dir());
@@ -470,7 +471,6 @@ static int assemble(Input input, const QInstaller::Settings &settings, const QSt
         QFile::remove(tempFile);
         return EXIT_FAILURE;
     }
-    out.setAutoRemove(false);
 
 #ifndef Q_OS_WIN
     chmod755(out.fileName());