From 63ad52d99146e3b2d8a472bdf92f200e14ae4eae Mon Sep 17 00:00:00 2001 From: Mate Barany Date: Tue, 2 Jul 2024 17:01:45 +0200 Subject: [PATCH] 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 (cherry picked from commit b9511f582a37b6dfc58d7ce9c2526565cda655c5) Reviewed-by: Qt Cherry-pick Bot --- src/network/kernel/qnetworkinterface_linux.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/network/kernel/qnetworkinterface_linux.cpp b/src/network/kernel/qnetworkinterface_linux.cpp index 67ed8006bb7..89374d2c4cf 100644 --- a/src/network/kernel/qnetworkinterface_linux.cpp +++ b/src/network/kernel/qnetworkinterface_linux.cpp @@ -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))