Skip to content

Commit

Permalink
fix patch
Browse files Browse the repository at this point in the history
  • Loading branch information
PeterPetrik committed Feb 5, 2021
1 parent ff5d668 commit 40ca7e8
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions qgis_deps/recipes/spatialindex/patches/temporaryfile.patch
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
--- a/src/tools/Tools.cc 2019-10-24 03:48:36.000000000 +0200
+++ b/src/tools/Tools.cc 2021-02-04 09:18:13.000000000 +0100
@@ -1079,10 +1079,26 @@ Tools::TemporaryFile::TemporaryFile()
+++ b/src/tools/Tools.cc 2021-02-05 09:08:21.000000000 +0100
@@ -1079,10 +1079,28 @@ Tools::TemporaryFile::TemporaryFile()
m_sFile = std::string(tmpName);

#else
- char tmpName[7] = "XXXXXX";
- if (mkstemp(tmpName) == -1)
+ // see https://github.com/boostorg/filesystem/blob/b4d606cdd08640c9bca68f7e97b52245aeef398d/src/operations.cpp#L2783
+ const char* val = nullptr;
+
Expand All @@ -21,11 +22,13 @@
+ std::string tempDir ((val != nullptr) ? val : default_tmp);
+
+ // now contruct the temporary filename
+ char tmpName[20] = "spatialindex-XXXXXX";
if (mkstemp(tmpName) == -1)
+ std::string tempName = tempDir + "/spatialindex-XXXXXX";
+ char* tmpName = strdup(tempName.c_str());
+ if (!tmpName || mkstemp(tmpName) == -1)
throw std::ios_base::failure("Tools::TemporaryFile: Cannot create temporary file name.");
- m_sFile = tmpName;
+ m_sFile = tempDir + "/" + tmpName;
+ m_sFile = tmpName;
+ free(tmpName);
#endif

m_pFile = new Tools::BufferedFileWriter(m_sFile, Tools::CREATE);

0 comments on commit 40ca7e8

Please sign in to comment.