diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-04-23 09:55:02 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2009-07-02 11:29:36 (GMT) |
commit | cad1bf4c902899ec1a8277d46272afa23fc2b34b (patch) | |
tree | bc4c4f318893d2d8723b4898fc4edcf544eb4b83 /src/gui/embedded/qkbdvfb_qws.cpp | |
parent | 27fc6ef5dfb7d58af778de162298fdc4da34459f (diff) | |
download | Qt-cad1bf4c902899ec1a8277d46272afa23fc2b34b.zip Qt-cad1bf4c902899ec1a8277d46272afa23fc2b34b.tar.gz Qt-cad1bf4c902899ec1a8277d46272afa23fc2b34b.tar.bz2 |
Port gui/embedded to the EINTR-safe functions.
I think I found two file descriptor that aren't closed. One seems like
a genuine leak, the other seems intentional.
Reviewed-By: ossi
Diffstat (limited to 'src/gui/embedded/qkbdvfb_qws.cpp')
-rw-r--r-- | src/gui/embedded/qkbdvfb_qws.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/src/gui/embedded/qkbdvfb_qws.cpp b/src/gui/embedded/qkbdvfb_qws.cpp index 082aac1..a44183b 100644 --- a/src/gui/embedded/qkbdvfb_qws.cpp +++ b/src/gui/embedded/qkbdvfb_qws.cpp @@ -55,6 +55,7 @@ #include <qwindowsystem_qws.h> #include <qsocketnotifier.h> #include <qapplication.h> +#include <private/qcore_unix_p.h> // overrides QT_OPEN QT_BEGIN_NAMESPACE @@ -69,13 +70,13 @@ QVFbKeyboardHandler::QVFbKeyboardHandler(const QString &device) kbdBufferLen = sizeof(QVFbKeyData) * 5; kbdBuffer = new unsigned char [kbdBufferLen]; - if ((kbdFD = open(terminalName.toLatin1().constData(), O_RDONLY | O_NDELAY)) < 0) { + if ((kbdFD = QT_OPEN(terminalName.toLatin1().constData(), O_RDONLY | O_NDELAY)) < 0) { qWarning("Cannot open %s (%s)", terminalName.toLatin1().constData(), strerror(errno)); } else { // Clear pending input char buf[2]; - while (read(kbdFD, buf, 1) > 0) { } + while (QT_READ(kbdFD, buf, 1) > 0) { } notifier = new QSocketNotifier(kbdFD, QSocketNotifier::Read, this); connect(notifier, SIGNAL(activated(int)),this, SLOT(readKeyboardData())); @@ -85,7 +86,7 @@ QVFbKeyboardHandler::QVFbKeyboardHandler(const QString &device) QVFbKeyboardHandler::~QVFbKeyboardHandler() { if (kbdFD >= 0) - close(kbdFD); + QT_CLOSE(kbdFD); delete [] kbdBuffer; } @@ -94,7 +95,7 @@ void QVFbKeyboardHandler::readKeyboardData() { int n; do { - n = read(kbdFD, kbdBuffer+kbdIdx, kbdBufferLen - kbdIdx); + n = QT_READ(kbdFD, kbdBuffer+kbdIdx, kbdBufferLen - kbdIdx); if (n > 0) kbdIdx += n; } while (n > 0); |