mirror of
https://github.com/subsurface/subsurface.git
synced 2024-12-01 06:30:26 +00:00
Don't use tmpfile()
It appears that at least on Win7-64 Windows tries to create the temporary file in C:\ and fails because of insufficient permissions. How stupid is that. Instead we roll our own tempfiles, based on the already existing tempfile name that is passed in. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
092a973f7c
commit
3fd8e50044
1 changed files with 6 additions and 2 deletions
|
@ -5,6 +5,7 @@
|
|||
#include <libxml/parser.h>
|
||||
#include <zip.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#include <QDir>
|
||||
#include <QHttpMultiPart>
|
||||
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue