Add the nodiscard qualifier to the constructor of NetlinkSocket

This is a RAII class the result of the constructor call should never be
discarded.

As a drive-by made the constructor explicit.

Task-number: QTBUG-125026
Pick-to: 6.7 6.5
Change-Id: I651dda87b5191d50e111732d11bab8d5aa58e9af
Reviewed-by: Marc Mutz <marc.mutz@qt.io>
(cherry picked from commit b9511f582a37b6dfc58d7ce9c2526565cda655c5)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Mate Barany 2024-07-02 17:01:45 +02:00 committed by Qt Cherry-pick Bot
parent 02fd2c19fd
commit 63ad52d991

View File

@ -88,7 +88,7 @@ namespace {
struct NetlinkSocket
{
int sock;
NetlinkSocket(int bufferSize)
Q_NODISCARD_CTOR explicit NetlinkSocket(int bufferSize)
{
sock = qt_safe_socket(AF_NETLINK, SOCK_DGRAM, NETLINK_ROUTE);
if (Q_UNLIKELY(sock == -1))