diff options
author | Markus Goetz <Markus.Goetz@nokia.com> | 2010-01-25 14:12:51 (GMT) |
---|---|---|
committer | Markus Goetz <Markus.Goetz@nokia.com> | 2010-01-25 14:27:33 (GMT) |
commit | 2109c57ef1fe2d8bbea2ed53c0f76c036843352d (patch) | |
tree | ff1f57e9eba0ca8546b8b94ea165e67d6c8eb344 | |
parent | ef89c6a9f39924a3c8366ad9522b42e7b1915b01 (diff) | |
download | Qt-2109c57ef1fe2d8bbea2ed53c0f76c036843352d.zip Qt-2109c57ef1fe2d8bbea2ed53c0f76c036843352d.tar.gz Qt-2109c57ef1fe2d8bbea2ed53c0f76c036843352d.tar.bz2 |
QNativeSocketEngine: Set OS error strings on failed read()
Reviewed-by: thiago
-rw-r--r-- | src/network/socket/qnativesocketengine.cpp | 7 | ||||
-rw-r--r-- | src/network/socket/qnativesocketengine_unix.cpp | 2 | ||||
-rw-r--r-- | src/network/socket/qnativesocketengine_win.cpp | 2 |
3 files changed, 7 insertions, 4 deletions
diff --git a/src/network/socket/qnativesocketengine.cpp b/src/network/socket/qnativesocketengine.cpp index 9e7bb27..a890b3b 100644 --- a/src/network/socket/qnativesocketengine.cpp +++ b/src/network/socket/qnativesocketengine.cpp @@ -779,8 +779,11 @@ qint64 QNativeSocketEngine::read(char *data, qint64 maxSize) close(); return -1; } else if (readBytes == -1) { - d->setError(QAbstractSocket::NetworkError, - QNativeSocketEnginePrivate::ReadErrorString); + if (!d->hasSetSocketError) { + d->hasSetSocketError = true; + d->socketError = QAbstractSocket::NetworkError; + d->socketErrorString = qt_error_string(); + } close(); return -1; } diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index d3b0fe5..9a2c349 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -903,7 +903,7 @@ qint64 QNativeSocketEnginePrivate::nativeRead(char *data, qint64 maxSize) case EBADF: case EINVAL: case EIO: - setError(QAbstractSocket::NetworkError, ReadErrorString); + //error string is now set in read(), not here in nativeRead() break; #ifdef Q_OS_SYMBIAN case EPIPE: diff --git a/src/network/socket/qnativesocketengine_win.cpp b/src/network/socket/qnativesocketengine_win.cpp index bbe9fde..8177b4f 100644 --- a/src/network/socket/qnativesocketengine_win.cpp +++ b/src/network/socket/qnativesocketengine_win.cpp @@ -1068,7 +1068,7 @@ qint64 QNativeSocketEnginePrivate::nativeRead(char *data, qint64 maxLength) break; case WSAEBADF: case WSAEINVAL: - setError(QAbstractSocket::NetworkError, ReadErrorString); + //error string is now set in read(), not here in nativeRead() break; case WSAECONNRESET: case WSAECONNABORTED: |