diff options
author | Thiago Macieira <thiago.macieira@intel.com> | 2014-06-05 17:15:03 -0700 |
---|---|---|
committer | The Qt Project <gerrit-noreply@qt-project.org> | 2014-06-12 17:54:11 +0200 |
commit | 6ca3ab626a04c3b05e6b3fde9a48457cf89c2889 (patch) | |
tree | 656df3d442da9539b2757b21cf6b045d0468f800 /src/corelib/io/qprocess.cpp | |
parent | 25ef58fe185f1534d9d89aee72e84c3789068907 (diff) |
Don't try to read from invalid file descriptors in QProcess
strace reveals that we do ioctl(-1, FIONREAD) and get EBADF. The only
case where this could happen is inside _q_processDied, which calls the
read functions without checking if the pipe is still open.
Change-Id: I67637fc4267be73fc03d40c444fdfea89e1ef715
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Diffstat (limited to 'src/corelib/io/qprocess.cpp')
-rw-r--r-- | src/corelib/io/qprocess.cpp | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/corelib/io/qprocess.cpp b/src/corelib/io/qprocess.cpp index 615e584f81..0436aa5428 100644 --- a/src/corelib/io/qprocess.cpp +++ b/src/corelib/io/qprocess.cpp @@ -903,6 +903,9 @@ void QProcessPrivate::cleanup() bool QProcessPrivate::tryReadFromChannel(Channel *channel) { Q_Q(QProcess); + if (channel->pipe[0] == INVALID_Q_PIPE) + return false; + qint64 available = bytesAvailableInChannel(channel); if (available == 0) { if (channel->notifier) |