diff options
author | João Abecasis <joao@abecasis.name> | 2009-11-16 15:11:09 (GMT) |
---|---|---|
committer | João Abecasis <joao@abecasis.name> | 2009-11-17 13:00:58 (GMT) |
commit | 72ee915bb0465549b7ca8e62d2af146cc44fdeac (patch) | |
tree | ec850793382e74a1e77728c45b475262995e7011 /src | |
parent | 98a05681851db9d88b1364af52be543715fbe306 (diff) | |
download | Qt-72ee915bb0465549b7ca8e62d2af146cc44fdeac.zip Qt-72ee915bb0465549b7ca8e62d2af146cc44fdeac.tar.gz Qt-72ee915bb0465549b7ca8e62d2af146cc44fdeac.tar.bz2 |
Fix regression introduced in c08e708037d33271825ce6a6a1ac640e96b70c36
When writing nothing to a file, not actually writing anything is not an
error.
Also, from a change introduced in the same commit, there is no point in
checking for EOF when writing.
Task-number: QTBUG-5847
Reviewed-by: Olivier Goffart
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/io/qfsfileengine.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp index 9ab831f..3cf9b7e 100644 --- a/src/corelib/io/qfsfileengine.cpp +++ b/src/corelib/io/qfsfileengine.cpp @@ -762,12 +762,10 @@ qint64 QFSFileEnginePrivate::writeFdFh(const char *data, qint64 len) // Buffered stdlib mode. size_t result; - bool eof; do { result = fwrite(data + writtenBytes, 1, size_t(len - writtenBytes), fh); writtenBytes += result; - eof = feof(fh); - } while (!eof && (result == 0 ? errno == EINTR : writtenBytes < len)); + } while (result == 0 ? errno == EINTR : writtenBytes < len); } else if (fd != -1) { // Unbuffered stdio mode. @@ -783,7 +781,7 @@ qint64 QFSFileEnginePrivate::writeFdFh(const char *data, qint64 len) || (result > 0 && (writtenBytes += result) < len)); } - if (writtenBytes == 0) { + if (len && writtenBytes == 0) { writtenBytes = -1; q->setError(errno == ENOSPC ? QFile::ResourceError : QFile::WriteError, qt_error_string(errno)); } |