diff --git a/qt-ui/subsurfacewebservices.cpp b/qt-ui/subsurfacewebservices.cpp index 6fa0b0afe..e7f81d7fa 100644 --- a/qt-ui/subsurfacewebservices.cpp +++ b/qt-ui/subsurfacewebservices.cpp @@ -5,6 +5,7 @@ #include #include #include +#include #include #include @@ -149,7 +150,10 @@ bool DivelogsDeWebServices::prepare_dives_for_divelogs(const QString &tempfile, */ if (selected && !dive->selected) continue; - f = tmpfile(); + QString innerTmpFile = tempfile; + QString tmpSuffix = QString::number(qrand() % 9999) + ".tmp"; + innerTmpFile.replace(".dld", tmpSuffix); + f = fopen(QFile::encodeName(QDir::toNativeSeparators(innerTmpFile)), "w+"); if (!f) { report_error(tr("cannot create temporary file: %s").toUtf8(), qt_error_string().toUtf8().data()); goto error_close_zip; @@ -168,7 +172,7 @@ bool DivelogsDeWebServices::prepare_dives_for_divelogs(const QString &tempfile, } membuf[streamsize] = 0; fclose(f); - + unlink(QFile::encodeName(QDir::toNativeSeparators(innerTmpFile))); /* * Parse the memory buffer into XML document and * transform it to divelogs.de format, finally dumping