summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qfsfileengine.cpp
diff options
context:
space:
mode:
authorAhmad Samir <a.samirh78@gmail.com>2023-09-08 01:30:26 +0300
committerAhmad Samir <a.samirh78@gmail.com>2023-09-10 15:15:09 +0300
commit1849489315fc6ee8bc08c4bd0e1a0031459117e3 (patch)
tree78c83f93e1a15c5ff5363854add4d25b5d44f140 /src/corelib/io/qfsfileengine.cpp
parent3fbcf53828c039d1210e203c8c631d10e26deee1 (diff)
QFSFileEngine: fix logic
Inside the do-while loop the if body is executed if `eof` is true, which means the continue statement is redundant because the while loop condition contains `!eof`, so the do-while body doesn't get executed again after that. Change-Id: If0685eb482f29b88e9c8660886392483a3bd75ec Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io/qfsfileengine.cpp')
-rw-r--r--src/corelib/io/qfsfileengine.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/corelib/io/qfsfileengine.cpp b/src/corelib/io/qfsfileengine.cpp
index 0ff7da1ac4..2c86e85dd5 100644
--- a/src/corelib/io/qfsfileengine.cpp
+++ b/src/corelib/io/qfsfileengine.cpp
@@ -621,17 +621,15 @@ qint64 QFSFileEnginePrivate::readFdFh(char *data, qint64 len)
// Buffered stdlib mode.
size_t result;
- bool retry = true;
do {
result = fread(data + readBytes, 1, size_t(len - readBytes), fh);
eof = feof(fh);
- if (retry && eof && result == 0) {
+ if (eof && result == 0) {
// On OS X, this is needed, e.g., if a file was written to
// through another stream since our last read. See test
// tst_QFile::appendAndRead
QT_FSEEK(fh, QT_FTELL(fh), SEEK_SET); // re-sync stream.
- retry = false;
- continue;
+ break;
}
readBytes += result;
} while (!eof && (result == 0 ? errno == EINTR : readBytes < len));