summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfsfileengine.cpp
diff options
context:
space:
mode:
authorJoão Abecasis <joao@abecasis.name>2009-10-23 11:15:56 +0200
committerJoão Abecasis <joao@abecasis.name>2009-10-23 15:05:33 +0200
commit3be1b879c9fbe37b71cce3c95ec4a3753a25a641 (patch)
tree0a8c3fcda691a70068484d9c7d9174a846a78516 /src/corelib/io/qfsfileengine.cpp
parentd0fa7d4b30fa34fe2a684c331213528c193da85f (diff)
Check for non-zero return from fseek
While POSIX specifies a -1 return on error, on Windows only non-zero is documented for error conditions. All platforms agree that zero is returned on success so we check for that instead. Reviewed-by: Markus Goetz
Diffstat (limited to 'src/corelib/io/qfsfileengine.cpp')
-rw-r--r--src/corelib/io/qfsfileengine.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp
index c34f8ad474..a7de896d3c 100644
--- a/src/corelib/io/qfsfileengine.cpp
+++ b/src/corelib/io/qfsfileengine.cpp
@@ -317,9 +317,9 @@ bool QFSFileEnginePrivate::openFh(QIODevice::OpenMode openMode, FILE *fh)
int ret;
do {
ret = QT_FSEEK(fh, 0, SEEK_END);
- } while (ret == -1 && errno == EINTR);
+ } while (ret != 0 && errno == EINTR);
- if (ret == -1) {
+ if (ret != 0) {
q->setError(errno == EMFILE ? QFile::ResourceError : QFile::OpenError,
qt_error_string(int(errno)));
@@ -572,9 +572,9 @@ bool QFSFileEnginePrivate::seekFdFh(qint64 pos)
int ret;
do {
ret = QT_FSEEK(fh, QT_OFF_T(pos), SEEK_SET);
- } while (ret == -1 && errno == EINTR);
+ } while (ret != 0 && errno == EINTR);
- if (ret == -1) {
+ if (ret != 0) {
q->setError(QFile::ReadError, qt_error_string(int(errno)));
return false;
}