Compile fix for OpenBSD using Q_OS_OPENBSD defines

OpenBSD does not have EPROTO and LLINDEX.. LLINDEX is only a macro
pointing at sdl_index so use the FreeBSD macro from <net/if_dl.h> as a
a workaround.

Change-Id: Ic3ccecc1b671bb28d14da83ba915ec3fcad2657d
Reviewed-by: Richard J. Moore <rich@kde.org>
This commit is contained in:
Ralf Nolden 2016-05-31 13:15:56 +02:00
parent 28db26f691
commit a9bef62ec2

View File

@ -573,7 +573,9 @@ int QNativeSocketEnginePrivate::nativeAccept()
setError(QAbstractSocket::SocketResourceError, NotSocketErrorString);
break;
case EPROTONOSUPPORT:
#if !defined(Q_OS_OPENBSD)
case EPROTO:
#endif
case EAFNOSUPPORT:
case EINVAL:
setError(QAbstractSocket::UnsupportedSocketOperationError, ProtocolUnsupportedErrorString);
@ -904,7 +906,9 @@ qint64 QNativeSocketEnginePrivate::nativeReceiveDatagram(char *data, qint64 maxS
if (cmsgptr->cmsg_level == IPPROTO_IP && cmsgptr->cmsg_type == IP_RECVIF
&& cmsgptr->cmsg_len >= CMSG_LEN(sizeof(sockaddr_dl))) {
sockaddr_dl *sdl = reinterpret_cast<sockaddr_dl *>(CMSG_DATA(cmsgptr));
# if defined(Q_OS_OPENBSD)
# define LLINDEX(s) ((s)->sdl_index)
# endif
header->ifindex = LLINDEX(sdl);
}
# endif