Merge lp:~pefarrell/fluidity/spatialindex-mktemp into lp:fluidity

Proposed by Patrick Farrell
Status: Merged
Approved by: David Ham
Approved revision: 3471
Merged at revision: 3471
Proposed branch: lp:~pefarrell/fluidity/spatialindex-mktemp
Merge into: lp:fluidity
Diff against target: 19 lines (+7/-2)
1 file modified
spatialindex-1.5/src/tools/Tools.cc (+7/-2)
To merge this branch: bzr merge lp:~pefarrell/fluidity/spatialindex-mktemp
Reviewer Review Type Date Requested Status
David Ham Approve
Review via email: mp+61613@code.launchpad.net

Description of the change

I got annoyed by #783987, so I decided to fix it.

It passes on buildbot: http://buildbot-ocean.ese.ic.ac.uk:8080/builders/x86_64-spatialindex-mktemp-gcc4/builds/0

To post a comment you must log in.
Revision history for this message
David Ham (david-ham) wrote :

Looks right to me.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'spatialindex-1.5/src/tools/Tools.cc'
2--- spatialindex-1.5/src/tools/Tools.cc 2010-03-17 17:45:31 +0000
3+++ spatialindex-1.5/src/tools/Tools.cc 2011-05-19 16:51:42 +0000
4@@ -1166,9 +1166,14 @@
5 m_sFile = std::string(tmpName);
6
7 #else
8- char tmpName[7] = "XXXXXX";
9- if (mktemp(tmpName) == 0)
10+ char tmpName[] = "spatialindex.XXXXXX";
11+ int fd;
12+
13+ fd = mkstemp(tmpName);
14+ if (fd == -1)
15 throw std::ios_base::failure("Tools::TemporaryFile: Cannot create temporary file name.");
16+ close(fd);
17+
18 m_sFile = tmpName;
19 #endif
20