summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorHarald Fernengel <harald@trolltech.com>2009-03-31 16:25:28 (GMT)
committerHarald Fernengel <harald@trolltech.com>2009-03-31 16:25:28 (GMT)
commit0b8309b6b7820c0036f1f8cd2253477e67a8b165 (patch)
treedc0eb74ebb3476421dda6e58afe06627e7be58de /src
parenta78f2ea2313df413dc8f7659c6dc3d098b18c263 (diff)
downloadQt-0b8309b6b7820c0036f1f8cd2253477e67a8b165.zip
Qt-0b8309b6b7820c0036f1f8cd2253477e67a8b165.tar.gz
Qt-0b8309b6b7820c0036f1f8cd2253477e67a8b165.tar.bz2
use ftruncate() to resize a buffered file
using truncate() on the file name was a bad idea, since the OS had to open it again - on some file systems, this would just error out, so QFile::resize() failed by default. Reviewed-by: Thiago
Diffstat (limited to 'src')
-rw-r--r--src/corelib/io/qfsfileengine_unix.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/corelib/io/qfsfileengine_unix.cpp b/src/corelib/io/qfsfileengine_unix.cpp
index 0d88b06..8a0a3f5 100644
--- a/src/corelib/io/qfsfileengine_unix.cpp
+++ b/src/corelib/io/qfsfileengine_unix.cpp
@@ -935,6 +935,8 @@ bool QFSFileEngine::setSize(qint64 size)
Q_D(QFSFileEngine);
if (d->fd != -1)
return !QT_FTRUNCATE(d->fd, size);
+ if (d->fh)
+ return !QT_FTRUNCATE(QT_FILENO(d->fh), size);
return !QT_TRUNCATE(d->nativeFilePath.constData(), size);
}