From ace9e3f77632f5ef47cccf32a204880ebf6a0581 Mon Sep 17 00:00:00 2001 From: "Bradley T. Hughes" Date: Thu, 6 May 2010 13:03:40 +0200 Subject: Set multicast errors correctly If the system does not support SSM, but the source address is specified, the error is unsupported socket operation, not unsupported protocol. if setsockopt() returns an error we don't know about, set the error code/string to unknown error --- src/network/socket/qnativesocketengine_unix.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp index 512cd34..4be45b8 100644 --- a/src/network/socket/qnativesocketengine_unix.cpp +++ b/src/network/socket/qnativesocketengine_unix.cpp @@ -634,9 +634,9 @@ static bool doMulticast(QNativeSocketEnginePrivate *d, ssm4.imr_multiaddr.s_addr = htonl(groupAddress.toIPv4Address()); ssm4.imr_sourceaddr.s_addr = htonl(sourceAddress.toIPv4Address()); #else - // unreachable + // system doesn't support SSM d->setError(QAbstractSocket::UnsupportedSocketOperationError, - QNativeSocketEnginePrivate::ProtocolUnsupportedErrorString); + QNativeSocketEnginePrivate::OperationUnsupportedErrorString); return false; #endif } else { @@ -675,6 +675,8 @@ static bool doMulticast(QNativeSocketEnginePrivate *d, QNativeSocketEnginePrivate::OperationUnsupportedErrorString); break; default: + d->setError(QAbstractSocket::UnknownSocketError, + QNativeSocketEnginePrivate::UnknownSocketErrorString); break; } return false; -- cgit v0.12