]> git.ipfire.org Git - thirdparty/bind9.git/commit
Remove a superfluous check of sock->fd against -1
authorAram Sargsyan <aram@isc.org>
Wed, 12 Oct 2022 08:21:35 +0000 (08:21 +0000)
committerAram Sargsyan <aram@isc.org>
Wed, 12 Oct 2022 08:21:35 +0000 (08:21 +0000)
commitbe95ba0119dcd42cbe81ec2776a17b13d2ab947a
tree9261b25061ce1c9b809fd409e82ffbb4ce9cba1f
parent5dbbc29632dde842bf1d4723b3ac7d51bfe0dcac
Remove a superfluous check of sock->fd against -1

The check is left from when tcp_connect_direct() called isc__nm_socket()
and it was uncertain whether it had succeeded, but now isc__nm_socket()
is called before tcp_connect_direct(), so sock->fd cannot be -1.

    *** CID 357292:    (REVERSE_NEGATIVE)
    /lib/isc/netmgr/tcp.c: 309 in isc_nm_tcpconnect()
    303
    304      atomic_store(&sock->active, true);
    305
    306      result = tcp_connect_direct(sock, req);
    307      if (result != ISC_R_SUCCESS) {
    308      atomic_store(&sock->active, false);
    >>>     CID 357292:    (REVERSE_NEGATIVE)
    >>>     You might be using variable "sock->fd" before verifying that it is >= 0.
    309      if (sock->fd != (uv_os_sock_t)(-1)) {
    310      isc__nm_tcp_close(sock);
    311      }
    312      isc__nm_connectcb(sock, req, result, true);
    313      }
    314
lib/isc/netmgr/tcp.c