Changeset 928 for trunk/src/corelib


Ignore:
Timestamp:
Aug 1, 2011, 9:56:31 PM (14 years ago)
Author:
Dmitry A. Kuminov
Message:

OS/2: QProcess: Fixed the way how pipes are closed.

This makes sure that feof() will return 1 and ferror() will not
return 1 on the child end of the pipe connected to its stdin.
This in turn fixes programs that check the ferror() value to
decide if the input data is valid, as well as programs using
feof() as the only way to break the input stream read loop.

File:
1 edited

Legend:

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

    r918 r928  
    6767    static FILE *f = 0;
    6868    if (!f) {
    69         f = fopen("\\qprocess.dbg", "w");
     69        f = fopen("\\qprocess.dbg", "w");
    7070        setbuf(f, NULL);
    7171    }
     
    624624    }
    625625    if (pipe.server != HPIPE(~0)) {
    626         DosDisConnectNPipe(pipe.server);
     626        // Note: We do not call DosDisConnectNPipe() as this is not necessary
     627        // and will only cause DosRead() on the other side to return
     628        // ERROR_PIPE_NOT_CONNECTED that will be interpreted by LIBC read() and
     629        // fread() as an error (ferror() will return true) and some programs
     630        // don't like it (e.g. 7z, rar32 when reading data from stdin).
    627631        DosClose(pipe.server);
    628632        pipe.server = HPIPE(~0);
Note: See TracChangeset for help on using the changeset viewer.