Remove redundant invalid socket check

It happens after the same socket check has lead to an early return.
Prompted by a PVS-studio article.

Change-Id: I63b42abed9102df73d29e6ff8a89a475751d4b91
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io>
This commit is contained in:
Edward Welbourne 2021-02-17 12:21:54 +01:00
parent 94b9ee03b5
commit a54177cb94
2 changed files with 6 additions and 10 deletions

View File

@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
** Copyright (C) 2016 Intel Corporation. ** Copyright (C) 2016 Intel Corporation.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
@ -312,10 +312,8 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc
#endif #endif
socketDescriptor = socket; socketDescriptor = socket;
if (socket != -1) { this->socketProtocol = socketProtocol;
this->socketProtocol = socketProtocol; this->socketType = socketType;
this->socketType = socketType;
}
return true; return true;
} }

View File

@ -1,6 +1,6 @@
/**************************************************************************** /****************************************************************************
** **
** Copyright (C) 2016 The Qt Company Ltd. ** Copyright (C) 2021 The Qt Company Ltd.
** Copyright (C) 2016 Intel Corporation. ** Copyright (C) 2016 Intel Corporation.
** Contact: https://www.qt.io/licensing/ ** Contact: https://www.qt.io/licensing/
** **
@ -426,10 +426,8 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc
sendmsg = 0; sendmsg = 0;
socketDescriptor = socket; socketDescriptor = socket;
if (socket != INVALID_SOCKET) { this->socketProtocol = socketProtocol;
this->socketProtocol = socketProtocol; this->socketType = socketType;
this->socketType = socketType;
}
// Make the socket nonblocking. // Make the socket nonblocking.
if (!setOption(QAbstractSocketEngine::NonBlockingSocketOption, 1)) { if (!setOption(QAbstractSocketEngine::NonBlockingSocketOption, 1)) {