diff options
-rw-r--r-- | src/serialport/qserialport_unix.cpp | 6 | ||||
-rw-r--r-- | src/serialport/qserialport_win.cpp | 6 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/serialport/qserialport_unix.cpp b/src/serialport/qserialport_unix.cpp index 2f6c8ccb..92d9f2f4 100644 --- a/src/serialport/qserialport_unix.cpp +++ b/src/serialport/qserialport_unix.cpp @@ -429,7 +429,8 @@ bool QSerialPortPrivate::waitForReadyRead(int msecs) bool timedOut = false; if (!waitForReadOrWrite(&readyToRead, &readyToWrite, true, !writeBuffer.isEmpty(), timeoutValue(msecs, stopWatch.elapsed()), &timedOut)) { - q_ptr->setError(decodeSystemError()); + if (!timedOut) + q_ptr->setError(decodeSystemError()); return false; } @@ -460,7 +461,8 @@ bool QSerialPortPrivate::waitForBytesWritten(int msecs) bool timedOut = false; if (!waitForReadOrWrite(&readyToRead, &readyToWrite, true, !writeBuffer.isEmpty(), timeoutValue(msecs, stopWatch.elapsed()), &timedOut)) { - q_ptr->setError(decodeSystemError()); + if (!timedOut) + q_ptr->setError(decodeSystemError()); return false; } diff --git a/src/serialport/qserialport_win.cpp b/src/serialport/qserialport_win.cpp index c3261a22..129df7ea 100644 --- a/src/serialport/qserialport_win.cpp +++ b/src/serialport/qserialport_win.cpp @@ -476,7 +476,8 @@ bool QSerialPortPrivate::waitForReadyRead(int msecs) if (!waitAnyEvent(timeoutValue(msecs, stopWatch.elapsed()), &timedOut, &n) || !n) { // This is occur timeout or another error - q_ptr->setError(decodeSystemError()); + if (!timedOut) + q_ptr->setError(decodeSystemError()); return false; } @@ -511,7 +512,8 @@ bool QSerialPortPrivate::waitForBytesWritten(int msecs) AbstractOverlappedEventNotifier *n = 0; if (!waitAnyEvent(timeoutValue(msecs, stopWatch.elapsed()), &timedOut, &n) || !n) { - q_ptr->setError(decodeSystemError()); + if (!timedOut) + q_ptr->setError(decodeSystemError()); return false; } |