better tmp dir selection

This commit is contained in:
Patrick Brosi 2019-05-14 00:11:15 +02:00
parent 9d19e344d3
commit 347badf770
8 changed files with 83 additions and 52 deletions

View file

@ -271,15 +271,14 @@ uint32_t OsmIdSet::hash(uint32_t in, int i) const {
// _____________________________________________________________________________
int OsmIdSet::openTmpFile() const {
const std::string& fname = getTmpFName(_tmpPath, "");
const std::string& fname = getTmpFName("", "");
int file = open(fname.c_str(), O_RDWR | O_CREAT, 0666);
// immediately unlink
unlink(fname.c_str());
if (file < 0) {
std::cerr << "Could not open temporary file " << fname
<< std::endl;
std::cerr << "Could not open temporary file " << fname << std::endl;
exit(1);
}

View file

@ -34,7 +34,6 @@ static const size_t OBUFFER_S = 8 * 1024 * 1024;
class OsmIdSet {
public:
OsmIdSet();
OsmIdSet(const std::string& tmpPath) : _tmpPath(tmpPath) {};
~OsmIdSet();
// Add an OSM id