Changeset 923


Ignore:
Timestamp:
Jul 31, 2011, 9:07:15 PM (9 years ago)
Author:
Dmitry A. Kuminov
Message:

OS/2: Fix QFile::atEnd() returning 0 on a pipe after it is closed.

This is to be compatible with other platforms (e.g. Linux) and with
software that incorrectly uses the while(file.atEnd()) loop to read
data from a file.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/corelib/io/qfsfileengine.cpp

    r846 r923  
    890890    Q_D(QFSFileEngine);
    891891    if (extension == AtEndExtension && d->fh && isSequential())
     892#ifdef Q_OS_OS2
     893        // On OS/2 feof() doesn't return 1 when the stream is a pipe and the
     894        // other end of the pipe gets closed. This makes programs using the
     895        // somewhat incorrect "while (qfile.atEnd())..." loop spin forever (UIC
     896        // is one of such programs). In order to fix it, we use ferror() which
     897        // does return 1 in cases like that.
     898        return feof(d->fh) || ferror(d->fh);
     899#else
    892900        return feof(d->fh);
     901#endif
    893902
    894903    if (extension == MapExtension) {
Note: See TracChangeset for help on using the changeset viewer.